Skip to content

panic: interface conversion: types.Type is *types.Alias, not *types.Named (again) #1136

Closed
@jcardali

Description

@jcardali

Similar to #1053 and #1076.

I am running into this error in CI (Go version 1.23) with the following stack trace:

/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
panic: interface conversion: types.Type is *types.Alias, not *types.Named
goroutine 1 [running]:
sigs.k8s.io/controller-tools/pkg/deepcopy.shouldBeCopied(0xc000ec17e0, 0xc0508ef860)
	/pkg/mod/sigs.k8s.io/[email protected]/pkg/deepcopy/traverse.go:623 +0x269
sigs.k8s.io/controller-tools/pkg/deepcopy.(*ObjectGenCtx).generateForPackage.func1(0xc0508ef860)
	/pkg/mod/sigs.k8s.io/[email protected]/pkg/deepcopy/gen.go:229 +0x85
sigs.k8s.io/controller-tools/pkg/markers.EachType.func1(0xc0081390e0, 0xc009d45bc0, 0xc009d45b80)
	/pkg/mod/sigs.k8s.io/[email protected]/pkg/markers/zip.go:222 +0x250
sigs.k8s.io/controller-tools/pkg/loader.(*typeVisitor).Visit(0x2c?, {0xec36a0?, 0xc009d45b80?})
	/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/visit.go:64 +0xa7
go/ast.Walk({0xec0b00?, 0xc050964b40?}, {0xec36a0, 0xc009d45b80})
	/usr/local/go/src/go/ast/walk.go:34 +0x4c
go/ast.walkList[...](...)
	/usr/local/go/src/go/ast/walk.go:21
go/ast.Walk({0xec0b00?, 0xc050964b40?}, {0xec36f0, 0xc009d45bc0})
	/usr/local/go/src/go/ast/walk.go:320 +0x262d
go/ast.walkList[...](...)
	/usr/local/go/src/go/ast/walk.go:21
go/ast.Walk({0xec0b00?, 0xc050964b40?}, {0xec36c8, 0xc0081390e0})
	/usr/local/go/src/go/ast/walk.go:341 +0x3585
sigs.k8s.io/controller-tools/pkg/loader.EachType(0xc000ec17e0, 0xc050964b28)
	/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/visit.go:38 +0x92
sigs.k8s.io/controller-tools/pkg/markers.EachType(0xc8e660?, 0xc000ec17e0, 0xc050bc6cc0)
	/pkg/mod/sigs.k8s.io/[email protected]/pkg/markers/zip.go:198 +0x85
sigs.k8s.io/controller-tools/pkg/deepcopy.(*ObjectGenCtx).generateForPackage(0xc0565cfa70, 0xc000ec17e0)
	/pkg/mod/sigs.k8s.io/[email protected]/pkg/deepcopy/gen.go:219 +0x247
sigs.k8s.io/controller-tools/pkg/deepcopy.Generator.Generate({{0xc00003da4b?, 0x411f01?}, {0x0?, 0xd26de0?}}, 0xc00021c280)
	/pkg/mod/sigs.k8s.io/[email protected]/pkg/deepcopy/gen.go:155 +0x213
sigs.k8s.io/controller-tools/pkg/genall.(*Runtime).Run(0xc002503830)
	/pkg/mod/sigs.k8s.io/[email protected]/pkg/genall/genall.go:272 +0x234
main.main.func1(0xc0001f2200?, {0xc00009d960?, 0x4?, 0xd7195b?})
	/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:176 +0x6a
github.com/spf13/cobra.(*Command).execute(0xc000202c08, {0xc000036130, 0x2, 0x2})
	/pkg/mod/github.com/spf13/[email protected]/command.go:985 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0xc000202c08)
	/pkg/mod/github.com/spf13/[email protected]/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
	/pkg/mod/github.com/spf13/[email protected]/command.go:1041
main.main()
	/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:200 +0x2f6
make: *** [Makefile:68: generate] Error 2

Running controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..." on my local machine yields no errors.

Please let me know if there is any information I've omitted that might be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions