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

[Bug]: failed to install controller gen on go 1.22 linux/amd64 environment #483

Closed
lizzy-0323 opened this issue Jul 8, 2024 · 1 comment

Comments

@lizzy-0323
Copy link
Contributor

lizzy-0323 commented Jul 8, 2024

Describe the bug

When I trying to run make install , rising bug like this:

make install  
test -s /Users/liziyi/Code/godev/ob-operator/bin/controller-gen && /Users/liziyi/Code/godev/ob-operator/bin/controller-gen --version | grep -q v0.13.0  || \
        GOBIN=/Users/liziyi/Code/godev/ob-operator/bin go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.13.0 
/Users/liziyi/Code/godev/ob-operator/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
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=0x2 addr=0x0 pc=0x104e14f64]

goroutine 408 [running]:
go/types.(*Checker).handleBailout(0x140001dcc00, 0x14000e03d18)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/check.go:367 +0x9c
panic({0x1050eda60?, 0x105688af0?})
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/runtime/panic.go:770 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x1051b8990, 0x1056913a0})
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/sizes.go:228 +0x314
go/types.(*Config).sizeof(...)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/sizes.go:333
go/types.representableConst.func1({0x1051b8990?, 0x1056913a0?})
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/const.go:76 +0x9c
go/types.representableConst({0x1051bec30, 0x10565c438}, 0x140001dcc00, 0x1056913a0, 0x14000dffae8)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/const.go:106 +0x2b0
go/types.(*Checker).representation(0x140001dcc00, 0x14000b61640, 0x1056913a0)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/const.go:256 +0x68
go/types.(*Checker).representable(0x140001dcc00, 0x14000b61640, 0x1056913a0)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/const.go:239 +0x28
go/types.(*Checker).shift(0x140001dcc00, 0x14000b615c0, 0x14000b61640, {0x1051bca68, 0x1400135cea0}, 0x14)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/expr.go:650 +0x1d8
go/types.(*Checker).binary(0x140001dcc00, 0x14000b615c0, {0x1051bca68, 0x1400135cea0}, {0x1051bcf78, 0x14001363b00}, {0x1051bcf78, 0x14001363b20}, 0x14, 0x382a46)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/expr.go:796 +0x100
go/types.(*Checker).exprInternal(0x140001dcc00, 0x0, 0x14000b615c0, {0x1051bca68, 0x1400135cea0}, {0x0, 0x0})
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/expr.go:1416 +0x1d4
go/types.(*Checker).rawExpr(0x140001dcc00, 0x0, 0x14000b615c0, {0x1051bca68?, 0x1400135cea0?}, {0x0?, 0x0?}, 0x0)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/expr.go:979 +0x12c
go/types.(*Checker).exprInternal(0x140001dcc00, 0x0, 0x14000b615c0, {0x1051bc918, 0x14001363b40}, {0x0, 0x0})
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/expr.go:1320 +0x150
go/types.(*Checker).rawExpr(0x140001dcc00, 0x0, 0x14000b615c0, {0x1051bc918?, 0x14001363b40?}, {0x0?, 0x0?}, 0x0)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/expr.go:979 +0x12c
go/types.(*Checker).expr(0x140001dcc00, 0x1058eca68?, 0x14000b615c0, {0x1051bc918?, 0x14001363b40?})
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/expr.go:1513 +0x38
go/types.(*Checker).binary(0x140001dcc00, 0x14000b615c0, {0x1051bca68, 0x1400135ced0}, {0x1051bc918, 0x14001363b40}, {0x1051bcf78, 0x14001363b60}, 0xd, 0x382a4b)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/expr.go:783 +0x70
go/types.(*Checker).exprInternal(0x140001dcc00, 0x0, 0x14000b615c0, {0x1051bca68, 0x1400135ced0}, {0x0, 0x0})
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/expr.go:1416 +0x1d4
go/types.(*Checker).rawExpr(0x140001dcc00, 0x0, 0x14000b615c0, {0x1051bca68?, 0x1400135ced0?}, {0x0?, 0x0?}, 0x1)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/expr.go:979 +0x12c
go/types.(*Checker).use1(0x140001dcc00, {0x1051bca68, 0x1400135ced0}, 0x0)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/call.go:1043 +0x1c4
go/types.(*Checker).useN(...)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/call.go:1004
go/types.(*Checker).use(...)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/call.go:994
go/types.(*Checker).callExpr(0x140001dcc00, 0x14000b61500, 0x14001376c00)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/call.go:196 +0x12a4
go/types.(*Checker).exprInternal(0x140001dcc00, 0x0, 0x14000b61500, {0x1051bd038, 0x14001376c00}, {0x0, 0x0})
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/expr.go:1374 +0xd0
go/types.(*Checker).rawExpr(0x140001dcc00, 0x0, 0x14000b61500, {0x1051bd038?, 0x14001376c00?}, {0x0?, 0x0?}, 0x0)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/expr.go:979 +0x12c
go/types.(*Checker).expr(0x140001dcc00, 0x140002ca1c0?, 0x14000b61500, {0x1051bd038?, 0x14001376c00?})
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/expr.go:1513 +0x38
go/types.(*Checker).exprInternal(0x140001dcc00, 0x0, 0x14000b61500, {0x1051bc9d8, 0x14001376c40}, {0x0, 0x0})
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/expr.go:1190 +0x1800
go/types.(*Checker).rawExpr(0x140001dcc00, 0x0, 0x14000b61500, {0x1051bc9d8?, 0x14001376c40?}, {0x0?, 0x0?}, 0x0)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/expr.go:979 +0x12c
go/types.(*Checker).expr(0x140001dcc00, 0x0?, 0x14000b61500, {0x1051bc9d8?, 0x14001376c40?})
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/expr.go:1513 +0x38
go/types.(*Checker).varDecl(0x140001dcc00, 0x140013beba0, {0x140023394d0, 0x1, 0x1}, {0x0, 0x0}, {0x1051bc9d8, 0x14001376c40})
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/decl.go:521 +0x140
go/types.(*Checker).objDecl(0x140001dcc00, {0x1051c3e60, 0x140013beba0}, 0x0)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/decl.go:194 +0x7ec
go/types.(*Checker).packageObjects(0x140001dcc00)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/resolver.go:693 +0x468
go/types.(*Checker).checkFiles(0x140001dcc00, {0x140019f2cc0, 0x7, 0x7})
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/check.go:408 +0x164
go/types.(*Checker).Files(...)
        /opt/homebrew/Cellar/go/1.22.4/libexec/src/go/types/check.go:372
sigs.k8s.io/controller-tools/pkg/loader.(*loader).typeCheck(0x1400030b470, 0x140001eb300)
        /Users/liziyi/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/loader.go:286 +0x2d8
sigs.k8s.io/controller-tools/pkg/loader.(*Package).NeedTypesInfo(0x140001eb300)
        /Users/liziyi/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/loader.go:99 +0x44
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check(0x14001a102d0, 0x140001eb300)
        /Users/liziyi/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/refs.go:268 +0x304
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check.func1(0x4f?)
        /Users/liziyi/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/refs.go:262 +0x58
created by sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check in goroutine 1
        /Users/liziyi/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/refs.go:260 +0x230
make: *** [manifests] Error 2

And I resolve it by bumping controller-gen to 0.14 version.
I found the similar issue in : kubernetes-sigs/controller-tools#880
I think it maybe good to update the docs

Environment

OS : Ubuntu 20.04
Go version : 1.22 linux/amd64

Fast reproduce steps

Using linux amd64 version and run

make run-local

Expected behavior

No response

Actual behavior

No response

Additional context

No response

@lizzy-0323 lizzy-0323 changed the title [Bug]: failed to install tools on go 1.22 linux/amd64 [Bug]: failed to install controller gen on go 1.22 linux/amd64 environment Jul 8, 2024
@powerfooI
Copy link
Collaborator

I have reproduced it on my three machines. It's truly a problem that causes new-coming developers stuck in installing required dependencies.

But it's weird that the controller-gen binary fetched about one year ago with version v0.13.0 worked very well. Once I deleted and reinstall it, the same error was thrown. Maybe in the same version some essentials of controller-gen changed.

Any PR to fix this is welcome!

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