Skip to content

Panics when building w/ Go 1.22.x #1521

@mamachanko

Description

@mamachanko

What steps did you take:

  1. Checkout kapp-controller
  2. Build with Golang 1.22

What happened:

❯ go version
go version go1.22.2 darwin/amd64

❯ git rev-parse @
6f2515eb308e4238b24c8a78fe201dc06a566cd0

❯ ./hack/build.sh
+ export CGO_ENABLED=0
+ CGO_ENABLED=0
+ go mod vendor
+ go mod tidy
+ go fmt ./cmd/... ./pkg/...
+ go build -trimpath -mod=vendor -o controller ./cmd/controller/...
+ ls -la ./controller
-rwxr-xr-x@ 1 *****  *****  ***** ***** ./controller
+ ./hack/gen-crds.sh
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=0xaa2ee4f]

goroutine 103 [running]:
go/types.(*Checker).handleBailout(0xc00077e800, 0xc001475d40)
        /usr/local/Cellar/go/1.22.2/libexec/src/go/types/check.go:367 +0x88
panic({0xad49760?, 0xb2fd820?})
        /usr/local/Cellar/go/1.22.2/libexec/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0xae14070, 0xb305f80})
        /usr/local/Cellar/go/1.22.2/libexec/src/go/types/sizes.go:228 +0x30f
go/types.(*Config).sizeof(...)
        /usr/local/Cellar/go/1.22.2/libexec/src/go/types/sizes.go:333
go/types.representableConst.func1({0xae14070?, 0xb305f80?})
        /usr/local/Cellar/go/1.22.2/libexec/src/go/types/const.go:76 +0x9e
go/types.representableConst({0xae1a2f0, 0xb2d1020}, 0xc00077e800, 0xb305f80, 0xc0014754b0)
        /usr/local/Cellar/go/1.22.2/libexec/src/go/types/const.go:92 +0x192
go/types.(*Checker).representation(0xc00077e800, 0xc001453480, 0xb305f80)
        /usr/local/Cellar/go/1.22.2/libexec/src/go/types/const.go:256 +0x65
go/types.(*Checker).implicitTypeAndValue(0xc00077e800, 0xc001453480, {0xae14098, 0xc0001daee0})
        /usr/local/Cellar/go/1.22.2/libexec/src/go/types/expr.go:375 +0x2d7
go/types.(*Checker).assignment(0xc00077e800, 0xc001453480, {0xae14098, 0xc0001daee0}, {0xab89f74, 0x14})
        /usr/local/Cellar/go/1.22.2/libexec/src/go/types/assignments.go:52 +0x2e5
go/types.(*Checker).initConst(0xc00077e800, 0xc00141d080, 0xc001453480)
        /usr/local/Cellar/go/1.22.2/libexec/src/go/types/assignments.go:126 +0x2c5
go/types.(*Checker).constDecl(0xc00077e800, 0xc00141d080, {0xae16c18, 0xc001a1a1c0}, {0xae16c18, 0xc001a1a1e0}, 0x0)
        /usr/local/Cellar/go/1.22.2/libexec/src/go/types/decl.go:490 +0x311
go/types.(*Checker).objDecl(0xc00077e800, {0xae1f380, 0xc00141d080}, 0x0)
        /usr/local/Cellar/go/1.22.2/libexec/src/go/types/decl.go:191 +0xa49
go/types.(*Checker).packageObjects(0xc00077e800)
        /usr/local/Cellar/go/1.22.2/libexec/src/go/types/resolver.go:693 +0x4dd
go/types.(*Checker).checkFiles(0xc00077e800, {0xc00198a000, 0x5, 0x5})
        /usr/local/Cellar/go/1.22.2/libexec/src/go/types/check.go:408 +0x1a5
go/types.(*Checker).Files(...)
        /usr/local/Cellar/go/1.22.2/libexec/src/go/types/check.go:372
sigs.k8s.io/controller-tools/pkg/loader.(*loader).typeCheck(0xc0002031a0, 0xc0014624c0)
        /Users/*****/workspace/carvel/kapp-controller/vendor/sigs.k8s.io/controller-tools/pkg/loader/loader.go:283 +0x36a
sigs.k8s.io/controller-tools/pkg/loader.(*Package).NeedTypesInfo(0xc0014624c0)
        /Users/*****/workspace/carvel/kapp-controller/vendor/sigs.k8s.io/controller-tools/pkg/loader/loader.go:96 +0x39
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check(0xc0009a9680, 0xc0014624c0)
        /Users/*****/workspace/carvel/kapp-controller/vendor/sigs.k8s.io/controller-tools/pkg/loader/refs.go:263 +0x2b7
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check.func1(0x65?)
        /Users/*****/workspace/carvel/kapp-controller/vendor/sigs.k8s.io/controller-tools/pkg/loader/refs.go:257 +0x53
created by sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check in goroutine 65
        /Users/*****/workspace/carvel/kapp-controller/vendor/sigs.k8s.io/controller-tools/pkg/loader/refs.go:255 +0x1c5
exit status 2

What did you expect:

kapp-controller can be built with any Golang >= 1.21

Anything else you would like to add:

Environment:

  • macOS
  • Golang 1.22.2

Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

Metadata

Metadata

Assignees

Labels

bugThis issue describes a defect or unexpected behaviorcarvel-acceptedThis issue should be considered for future work and that the triage process has been completedpriority/important-soonMust be staffed and worked on currently or soon.

Type

No type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions