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 nil, not *types.Named #1100

Closed
AshleyDumaine opened this issue Dec 4, 2024 · 1 comment
Closed

Comments

@AshleyDumaine
Copy link

I'm running into the same issue as #492, but I'm on [email protected] and go1.23.1:

GOBIN=/Users/adumaine/cluster-api-provider-linode/bin go install sigs.k8s.io/controller-tools/cmd/[email protected]
/Users/adumaine/cluster-api-provider-linode/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
GOBIN=/Users/adumaine/cluster-api-provider-linode/bin go install k8s.io/code-generator/cmd/[email protected]
/Users/adumaine/cluster-api-provider-linode/bin/conversion-gen ./api/v1alpha1 --go-header-file=./hack/boilerplate.go.txt --output-file=zz_generated.conversion.go
GOBIN=/Users/adumaine/cluster-api-provider-linode/bin go install github.com/hexdigest/gowrap/cmd/[email protected]
go generate ./...
/Users/adumaine/cluster-api-provider-linode/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
panic: interface conversion: types.Type is nil, not *types.Named

goroutine 1 [running]:
sigs.k8s.io/controller-tools/pkg/deepcopy.shouldBeCopied(0x14000bb0080, 0x14005c42960)
	/Users/adumaine/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/deepcopy/traverse.go:623 +0x27c
sigs.k8s.io/controller-tools/pkg/deepcopy.(*ObjectGenCtx).generateForPackage.func1(0x14005c42960)
	/Users/adumaine/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/deepcopy/gen.go:229 +0x6c
sigs.k8s.io/controller-tools/pkg/markers.EachType.func1(0x14000caa0a0, 0x140002b0880, 0x140002b0640)
	/Users/adumaine/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/markers/zip.go:222 +0x1f0
sigs.k8s.io/controller-tools/pkg/loader.(*typeVisitor).Visit(0x14003a0fc20?, {0x100bb17c0?, 0x140002b0640?})
	/Users/adumaine/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/visit.go:64 +0xc0
go/ast.Walk({0x100baeb60?, 0x140047695a8?}, {0x100bb17c0, 0x140002b0640})
	/opt/homebrew/Cellar/go/1.23.1/libexec/src/go/ast/walk.go:34 +0x44
go/ast.walkList[...](...)
	/opt/homebrew/Cellar/go/1.23.1/libexec/src/go/ast/walk.go:21
go/ast.Walk({0x100baeb60?, 0x140047695a8?}, {0x100bb1810, 0x140002b0880})
	/opt/homebrew/Cellar/go/1.23.1/libexec/src/go/ast/walk.go:320 +0x20f4
go/ast.walkList[...](...)
	/opt/homebrew/Cellar/go/1.23.1/libexec/src/go/ast/walk.go:21
go/ast.Walk({0x100baeb60?, 0x140047695a8?}, {0x100bb17e8, 0x14000caa0a0})
	/opt/homebrew/Cellar/go/1.23.1/libexec/src/go/ast/walk.go:341 +0x2e24
sigs.k8s.io/controller-tools/pkg/loader.EachType(0x14000bb0080, 0x14004769590)
	/Users/adumaine/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/visit.go:38 +0x98
sigs.k8s.io/controller-tools/pkg/markers.EachType(0x100ac64a0?, 0x14000bb0080, 0x14007aedd40)
	/Users/adumaine/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/markers/zip.go:198 +0x84
sigs.k8s.io/controller-tools/pkg/deepcopy.(*ObjectGenCtx).generateForPackage(0x14008313a38, 0x14000bb0080)
	/Users/adumaine/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/deepcopy/gen.go:219 +0x204
sigs.k8s.io/controller-tools/pkg/deepcopy.Generator.Generate({{0x1400003977b?, 0x100b48200?}, {0x0?, 0x1008030b0?}}, 0x140000626e0)
	/Users/adumaine/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/deepcopy/gen.go:155 +0x188
sigs.k8s.io/controller-tools/pkg/genall.(*Runtime).Run(0x140005b07e0)
	/Users/adumaine/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/genall/genall.go:272 +0x21c
main.main.func1(0x14000254200?, {0x1400009f900?, 0x4?, 0x1008dd617?})
	/Users/adumaine/go/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:176 +0x64
github.com/spf13/cobra.(*Command).execute(0x14000264c08, {0x140000302b0, 0x2, 0x2})
	/Users/adumaine/go/pkg/mod/github.com/spf13/[email protected]/command.go:985 +0x834
github.com/spf13/cobra.(*Command).ExecuteC(0x14000264c08)
	/Users/adumaine/go/pkg/mod/github.com/spf13/[email protected]/command.go:1117 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/adumaine/go/pkg/mod/github.com/spf13/[email protected]/command.go:1041
main.main()
	/Users/adumaine/go/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:200 +0x290
make: *** [generate-code] Error 2
@AshleyDumaine
Copy link
Author

I found my issue, it was that there was already a struct in an existing CRD with the same name as the resource kubebuilder was trying to create. Renaming the struct fixed it.

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

1 participant