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

controller-gen panics when calling make generate #456

Closed
frzifus opened this issue Apr 5, 2024 · 7 comments
Closed

controller-gen panics when calling make generate #456

frzifus opened this issue Apr 5, 2024 · 7 comments

Comments

@frzifus
Copy link
Member

frzifus commented Apr 5, 2024

It might be caused by the go version it was build with (open-telemetry/opentelemetry-operator#2753).

But I also tried to use the main (and #450) branch and an older go version fedora shipped with fedora 38 and still face the same issue:
e.g.

podman run --rm -it -v ${PWD}:/src:z fedora:38
cd /src && dnf install golang make && make operator

Panic

╰─❯ make operator
/home/frzifus/git/go/observability/rhobs-observability-operator/tmp/bin/controller-gen crd \
	paths=./pkg/apis/... \
	paths=./pkg/controllers/... \
	rbac:roleName=observability-operator \
	output:dir=. \
	output:rbac:dir=./deploy/operator \
	output:crd:dir=./deploy/crds/common
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa0963e]

goroutine 39 [running]:
go/types.(*Checker).handleBailout(0xc000c3bc00, 0xc00146dd40)
	/usr/local/go/src/go/types/check.go:367 +0x88
panic({0xbc4180?, 0x12aec40?})
	/usr/local/go/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0xdbcf58, 0x12b7440})
	/usr/local/go/src/go/types/sizes.go:228 +0x31e
go/types.(*Config).sizeof(...)
	/usr/local/go/src/go/types/sizes.go:333
go/types.representableConst.func1({0xdbcf58?, 0x12b7440?})
	/usr/local/go/src/go/types/const.go:76 +0x9e
go/types.representableConst({0xdc32d0, 0x12836f8}, 0xc000c3bc00, 0x12b7440, 0xc001469b40)
	/usr/local/go/src/go/types/const.go:106 +0x2c7
go/types.(*Checker).representation(0xc000c3bc00, 0xc001463d40, 0x12b7440)
	/usr/local/go/src/go/types/const.go:256 +0x65
go/types.(*Checker).representable(0xc000c3bc00, 0xc001463d40, 0x12b7440)
	/usr/local/go/src/go/types/const.go:239 +0x26
go/types.(*Checker).shift(0xc000c3bc00, 0xc001463cc0, 0xc001463d40, {0xdc10f8, 0xc000745770}, 0x14)
	/usr/local/go/src/go/types/expr.go:650 +0x1eb
go/types.(*Checker).binary(0xc000c3bc00, 0xc001463cc0, {0xdc10f8, 0xc000745770}, {0xdc1608, 0xc000be0060}, {0xdc1608, 0xc000be0080}, 0x14, 0x35eb5b)
	/usr/local/go/src/go/types/expr.go:796 +0x150
go/types.(*Checker).exprInternal(0xc000c3bc00, 0x0, 0xc001463cc0, {0xdc10f8, 0xc000745770}, {0x0, 0x0})
	/usr/local/go/src/go/types/expr.go:1416 +0x206
go/types.(*Checker).rawExpr(0xc000c3bc00, 0x0, 0xc001463cc0, {0xdc10f8?, 0xc000745770?}, {0x0?, 0x0?}, 0x0)
	/usr/local/go/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).exprInternal(0xc000c3bc00, 0x0, 0xc001463cc0, {0xdc0fa8, 0xc000be00a0}, {0x0, 0x0})
	/usr/local/go/src/go/types/expr.go:1320 +0x178
go/types.(*Checker).rawExpr(0xc000c3bc00, 0x0, 0xc001463cc0, {0xdc0fa8?, 0xc000be00a0?}, {0x0?, 0x0?}, 0x0)
	/usr/local/go/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).expr(0xc000c3bc00, 0x0?, 0xc001463cc0, {0xdc0fa8?, 0xc000be00a0?})
	/usr/local/go/src/go/types/expr.go:1513 +0x30
go/types.(*Checker).binary(0xc000c3bc00, 0xc001463cc0, {0xdc10f8, 0xc0007457a0}, {0xdc0fa8, 0xc000be00a0}, {0xdc1608, 0xc000be00c0}, 0xd, 0x35eb60)
	/usr/local/go/src/go/types/expr.go:783 +0xa5
go/types.(*Checker).exprInternal(0xc000c3bc00, 0x0, 0xc001463cc0, {0xdc10f8, 0xc0007457a0}, {0x0, 0x0})
	/usr/local/go/src/go/types/expr.go:1416 +0x206
go/types.(*Checker).rawExpr(0xc000c3bc00, 0x0, 0xc001463cc0, {0xdc10f8?, 0xc0007457a0?}, {0x0?, 0x0?}, 0x1)
	/usr/local/go/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).use1(0xc000c3bc00, {0xdc10f8, 0xc0007457a0}, 0x0)
	/usr/local/go/src/go/types/call.go:1043 +0x1a5
go/types.(*Checker).useN(...)
	/usr/local/go/src/go/types/call.go:1004
go/types.(*Checker).use(...)
	/usr/local/go/src/go/types/call.go:994
go/types.(*Checker).callExpr(0xc000c3bc00, 0xc001463c00, 0xc000746a40)
	/usr/local/go/src/go/types/call.go:196 +0x1770
go/types.(*Checker).exprInternal(0xc000c3bc00, 0x0, 0xc001463c00, {0xdc16c8, 0xc000746a40}, {0x0, 0x0})
	/usr/local/go/src/go/types/expr.go:1374 +0xf8
go/types.(*Checker).rawExpr(0xc000c3bc00, 0x0, 0xc001463c00, {0xdc16c8?, 0xc000746a40?}, {0x0?, 0x0?}, 0x0)
	/usr/local/go/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).expr(0xc000c3bc00, 0xc0000e6230?, 0xc001463c00, {0xdc16c8?, 0xc000746a40?})
	/usr/local/go/src/go/types/expr.go:1513 +0x30
go/types.(*Checker).exprInternal(0xc000c3bc00, 0x0, 0xc001463c00, {0xdc1068, 0xc000746a80}, {0x0, 0x0})
	/usr/local/go/src/go/types/expr.go:1190 +0x1f1f
go/types.(*Checker).rawExpr(0xc000c3bc00, 0x0, 0xc001463c00, {0xdc1068?, 0xc000746a80?}, {0x0?, 0x0?}, 0x0)
	/usr/local/go/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).expr(0xc000c3bc00, 0x0?, 0xc001463c00, {0xdc1068?, 0xc000746a80?})
	/usr/local/go/src/go/types/expr.go:1513 +0x30
go/types.(*Checker).varDecl(0xc000c3bc00, 0xc001398c00, {0xc000d14d98, 0x1, 0x1}, {0x0, 0x0}, {0xdc1068, 0xc000746a80})
	/usr/local/go/src/go/types/decl.go:521 +0x17b
go/types.(*Checker).objDecl(0xc000c3bc00, {0xdc8af8, 0xc001398c00}, 0x0)
	/usr/local/go/src/go/types/decl.go:194 +0x9e5
go/types.(*Checker).packageObjects(0xc000c3bc00)
	/usr/local/go/src/go/types/resolver.go:693 +0x4dd
go/types.(*Checker).checkFiles(0xc000c3bc00, {0xc000778100, 0x7, 0x7})
	/usr/local/go/src/go/types/check.go:408 +0x1a5
go/types.(*Checker).Files(...)
	/usr/local/go/src/go/types/check.go:372
sigs.k8s.io/controller-tools/pkg/loader.(*loader).typeCheck(0xc000351290, 0xc00007f520)
	/home/frzifus/git/golang_workspace/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/loader.go:286 +0x36a
sigs.k8s.io/controller-tools/pkg/loader.(*Package).NeedTypesInfo(0xc00007f520)
	/home/frzifus/git/golang_workspace/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/loader.go:99 +0x39
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check(0xc000949d70, 0xc00007f520)
	/home/frzifus/git/golang_workspace/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:268 +0x2b7
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check.func1(0x0?)
	/home/frzifus/git/golang_workspace/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:262 +0x53
created by sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check in goroutine 31
	/home/frzifus/git/golang_workspace/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:260 +0x1c5
make: *** [Makefile:85: generate-crds] Fehler 2
@tremes
Copy link
Contributor

tremes commented Apr 5, 2024

Interesting. I am on Fedora 38 with go1.21.1 and it works fine for me (I haven't tried go 1.22 yet). controller-gen is Version: v0.11.3. What is your go version pls?

@frzifus
Copy link
Member Author

frzifus commented Apr 9, 2024

On my machine its go version go1.22.0 linux/amd64 inside the fedora 38 container its go version go1.21.8 linux/amd64.

@tremes
Copy link
Contributor

tremes commented Apr 9, 2024

It's strange. The commands make operator and make generate work fine for me with go version go1.22.2 linux/amd64 on clean main branch 1fc0a34

@tremes
Copy link
Contributor

tremes commented Apr 9, 2024

OK I reproduced after calling make clean and make clean-tools

@tremes
Copy link
Contributor

tremes commented Apr 9, 2024

This should help #458

@frzifus
Copy link
Member Author

frzifus commented Apr 9, 2024

FTR: #455

@simonpasquier
Copy link
Contributor

It should be fixed now. Please re-open if it's not the case.

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

3 participants