Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jcardali opened this issue Jan 28, 2025 · 1 comment

Comments

@jcardali
Copy link

jcardali commented Jan 28, 2025

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.

@sbueringer
Copy link
Member

Can you please check if this also happens with controller-gen compiled from the main branch?

I think this PR might have fixed it: #1119 (it's not released yet)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants