crossplane / provider-template

A template for building @crossplane providers.
https://crossplane.io
Apache License 2.0
126 stars 72 forks source link

Panic when using go 1.22 #87

Closed malins closed 1 month ago

malins commented 2 months ago

Hello,

I'm trying to use provider-template with go 1.22, but it just throws a "panic" when executing "make reviewable".

15:45:15 [ .. ] verify go modules dependencies have expected content
all modules verified
15:45:16 [ OK ] go modules dependencies verified
15:45:17 [ .. ] go generate linux_amd64
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=0xa07b8f]

goroutine 174 [running]:
go/types.(*Checker).handleBailout(0xc001457800, 0xc00061fd40)
        /usr/lib/go-1.22/src/go/types/check.go:367 +0x88
panic({0xbbe580?, 0x12a34a0?})
        /usr/lib/go-1.22/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0xdb8218, 0x12abc40})
        /usr/lib/go-1.22/src/go/types/sizes.go:228 +0x30f
go/types.(*Config).sizeof(...)
        /usr/lib/go-1.22/src/go/types/sizes.go:333
go/types.representableConst.func1({0xdb8218?, 0x12abc40?})
        /usr/lib/go-1.22/src/go/types/const.go:76 +0x9e
go/types.representableConst({0xdbe570, 0x1276c80}, 0xc001457800, 0x12abc40, 0x0)
        /usr/lib/go-1.22/src/go/types/const.go:92 +0x192
go/types.(*Checker).arrayLength(0xc001457800, {0xdbc818, 0xc0019b9f60?})
        /usr/lib/go-1.22/src/go/types/typexpr.go:510 +0x2d3
go/types.(*Checker).typInternal(0xc001457800, {0xdbae38, 0xc0019bcff0}, 0x0)
        /usr/lib/go-1.22/src/go/types/typexpr.go:299 +0x49d
go/types.(*Checker).definedType(0xc001457800, {0xdbae38, 0xc0019bcff0}, 0xc00061f328?)
        /usr/lib/go-1.22/src/go/types/typexpr.go:180 +0x37
go/types.(*Checker).varType(0xc001457800, {0xdbae38, 0xc0019bcff0})
        /usr/lib/go-1.22/src/go/types/typexpr.go:145 +0x25
go/types.(*Checker).structType(0xc001457800, 0xc0018dd830, 0xc0018dd830?)
        /usr/lib/go-1.22/src/go/types/struct.go:113 +0x19f
go/types.(*Checker).typInternal(0xc001457800, {0xdbada8, 0xc0019abdd0}, 0xc0018e0dc0)
        /usr/lib/go-1.22/src/go/types/typexpr.go:316 +0x1345
go/types.(*Checker).definedType(0xc001457800, {0xdbada8, 0xc0019abdd0}, 0xc87855?)
        /usr/lib/go-1.22/src/go/types/typexpr.go:180 +0x37
go/types.(*Checker).typeDecl(0xc001457800, 0xc0018e0dc0, 0xc0019cc380, 0x0)
        /usr/lib/go-1.22/src/go/types/decl.go:615 +0x44d
go/types.(*Checker).objDecl(0xc001457800, {0xdc3ac0, 0xc0018e0dc0}, 0x0)
        /usr/lib/go-1.22/src/go/types/decl.go:197 +0xa7f
go/types.(*Checker).packageObjects(0xc001457800)
        /usr/lib/go-1.22/src/go/types/resolver.go:681 +0x425
go/types.(*Checker).checkFiles(0xc001457800, {0xc0017a30b0, 0x3, 0x3})
        /usr/lib/go-1.22/src/go/types/check.go:408 +0x1a5
go/types.(*Checker).Files(...)
        /usr/lib/go-1.22/src/go/types/check.go:372
sigs.k8s.io/controller-tools/pkg/loader.(*loader).typeCheck(0xc0002ef410, 0xc0000f1800)
        /home/manuel/go/pkg/mod/sigs.k8s.io/controller-tools@v0.12.1/pkg/loader/loader.go:286 +0x36a
sigs.k8s.io/controller-tools/pkg/loader.(*Package).NeedTypesInfo(0xc0000f1800)
        /home/manuel/go/pkg/mod/sigs.k8s.io/controller-tools@v0.12.1/pkg/loader/loader.go:99 +0x39
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check(0xc00063d050, 0xc0000f1800)
        /home/manuel/go/pkg/mod/sigs.k8s.io/controller-tools@v0.12.1/pkg/loader/refs.go:268 +0x2b7
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check.func1(0x24?)
        /home/manuel/go/pkg/mod/sigs.k8s.io/controller-tools@v0.12.1/pkg/loader/refs.go:262 +0x53
created by sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check in goroutine 161
        /home/manuel/go/pkg/mod/sigs.k8s.io/controller-tools@v0.12.1/pkg/loader/refs.go:260 +0x1c5
malins commented 1 month ago

Are there any plans to keep this template "up to date", or should it be rather marked as "archived"?

I got another error while trying to build the provider with docker CE version 26.

11:26:59 [ .. ] Building package provider-a1group-v0.0.0-8.gd4d9e99.dirty.xpkg for linux_amd64
up: error: unable to calculate manifest: blob sha256:10f855b03c8aee4fb0b9b7031c333640d684bd9ee6045f11f9892c7fea394701 not found

Most likely this is related to https://github.com/crossplane/crossplane/issues/5321.

It's not very convenient to downgrade a bunch of tools to make this provider template usable.

bobh66 commented 1 month ago

Did you try updating the build submodule to the latest commit? That should fix this issue. I think.

bobh66 commented 1 month ago

The template was just updated to use crossplane/build instead of upbound/build, so it might be worth pulling in those changes and seeing if it resolves the problem.

malins commented 1 month ago

Hi, the switch of the "build" submodule to crossplane/build solved the problem with the 26 docker client. Thank you. Keeping the issue open since the "panic" with go 1.22 persists.

karanadep-dexcom commented 1 month ago

I upgraded crossplane-runtime, crossplane-tools and controller-tools

github.com/crossplane/crossplane-runtime v1.16.0
github.com/crossplane/crossplane-tools v0.0.0-20240522174801-1ad3d4c87f21
sigs.k8s.io/controller-tools v0.15.0

Thats what its set currently - https://github.com/crossplane/provider-template/blob/main/go.mod#L6-L14