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 #492

Closed
heidsoft opened this issue Sep 19, 2020 · 6 comments
Closed

panic: interface conversion: types.Type is nil, not *types.Named #492

heidsoft opened this issue Sep 19, 2020 · 6 comments

Comments

@heidsoft
Copy link

 /Users/heidsoft/go/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(0xc000a94700, 0xc002d37140, 0x1004001)
	/Users/heidsoft/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/deepcopy/traverse.go:611 +0x35a
sigs.k8s.io/controller-tools/pkg/deepcopy.(*ObjectGenCtx).GenerateForPackage.func2(0xc002d37140)
	/Users/heidsoft/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/deepcopy/gen.go:226 +0xac
sigs.k8s.io/controller-tools/pkg/markers.EachType.func1(0xc000ca8180, 0xc000c82200, 0xc000ca41b0)
	/Users/heidsoft/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/markers/zip.go:179 +0x779
sigs.k8s.io/controller-tools/pkg/loader.(*typeVisitor).Visit(0xc0034585c0, 0x1972ce0, 0xc000ca41b0, 0x0, 0x0)
	/Users/heidsoft/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/visit.go:64 +0x140
go/ast.Walk(0x196e8e0, 0xc0034585c0, 0x1972ce0, 0xc000ca41b0)
	/usr/local/go/src/go/ast/walk.go:52 +0x66
go/ast.Walk(0x196e8e0, 0xc0034585c0, 0x1972720, 0xc000c82200)
	/usr/local/go/src/go/ast/walk.go:331 +0xf3b
go/ast.walkDeclList(0x196e8e0, 0xc0034585c0, 0xc000c832c0, 0x4, 0x4)
	/usr/local/go/src/go/ast/walk.go:38 +0x9e
go/ast.Walk(0x196e8e0, 0xc0034585c0, 0x19725e0, 0xc000ca8180)
	/usr/local/go/src/go/ast/walk.go:353 +0x264e
sigs.k8s.io/controller-tools/pkg/loader.EachType(0xc000a94700, 0xc003078920)
	/Users/heidsoft/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/visit.go:38 +0xaa
sigs.k8s.io/controller-tools/pkg/markers.EachType(0xc000a947a0, 0xc000a94700, 0xc0013198c0, 0x2, 0xc003701ee8)
	/Users/heidsoft/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/markers/zip.go:155 +0xa3
sigs.k8s.io/controller-tools/pkg/deepcopy.(*ObjectGenCtx).GenerateForPackage(0xc00469db40, 0xc000a94700, 0x1859e3e, 0x5, 0x1859188)
	/Users/heidsoft/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/deepcopy/gen.go:216 +0x1da
sigs.k8s.io/controller-tools/pkg/deepcopy.Generator.Generate(0xc000040f6b, 0x17, 0x0, 0x0, 0xc0000a6140, 0xc0001e2c01, 0xc0000a6140)
	/Users/heidsoft/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/deepcopy/gen.go:147 +0x1a5
sigs.k8s.io/controller-tools/pkg/genall.(*Runtime).Run(0xc0005db980, 0xc00000fce0)
	/Users/heidsoft/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/genall/genall.go:171 +0x15e
main.main.func1(0xc00018bb80, 0xc00000fce0, 0x2, 0x2, 0x0, 0x0)
	/Users/heidsoft/go/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:176 +0xa6
github.com/spf13/cobra.(*Command).execute(0xc00018bb80, 0xc0000321c0, 0x2, 0x2, 0xc00018bb80, 0xc0000321c0)
	/Users/heidsoft/go/pkg/mod/github.com/spf13/[email protected]/command.go:826 +0x453
github.com/spf13/cobra.(*Command).ExecuteC(0xc00018bb80, 0xc00000fc80, 0x4, 0x0)
	/Users/heidsoft/go/pkg/mod/github.com/spf13/[email protected]/command.go:914 +0x2fb
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/heidsoft/go/pkg/mod/github.com/spf13/[email protected]/command.go:864
main.main()
	/Users/heidsoft/go/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:200 +0x34a
@govinda-attal
Copy link

I think you might have used alias types such as type AliasType = string .. I came across this error, when I used aliases. Otherwise it works as a charm

@jaypipes
Copy link

jaypipes commented Oct 5, 2020

@heidsoft Try updating to a more modern version of controller-tools. I used to run into this issue with older versions.

@kgcarr
Copy link

kgcarr commented Oct 29, 2020

@heidsoft did you figure out a solution to this?

@heidsoft
Copy link
Author

heidsoft commented Nov 2, 2020

@kaitoy
No follow up now, I will try again later,thanks

@TerryHowe
Copy link
Member

For me, this error was caused by overriding ObjectMeta twice. Copy pasta problem.

@miffa
Copy link

miffa commented Apr 22, 2021

I think you might have used alias types such as type AliasType = string .. I came across this error, when I used aliases. Otherwise it works as a charm

figure out my problem

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

6 participants