operator-sdk icon indicating copy to clipboard operation
operator-sdk copied to clipboard

Support Go 1.22 and/or 1.23

Open stefanb opened this issue 1 year ago • 3 comments

Bug Report

What did you do?

Tried to build with Go 1.22 in

  • https://github.com/Homebrew/homebrew-core/pull/178113

What did you expect to see?

Build to succeed.

What did you see instead? Under which circumstances?

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=0xa0df0f]
  
  goroutine 139 [running]:
  go/types.(*Checker).handleBailout(0xc0005e6a00, 0xc000057d40)
  	/home/linuxbrew/.linuxbrew/Cellar/go/1.22.5/libexec/src/go/types/check.go:367 +0x88
  panic({0xbc8860?, 0x12be880?})
  	/home/linuxbrew/.linuxbrew/Cellar/go/1.22.5/libexec/src/runtime/panic.go:770 +0x132
  go/types.(*StdSizes).Sizeof(0x0, {0xdc4618, 0x12c7080})
  	/home/linuxbrew/.linuxbrew/Cellar/go/1.22.5/libexec/src/go/types/sizes.go:228 +0x30f
  go/types.(*Config).sizeof(...)
  	/home/linuxbrew/.linuxbrew/Cellar/go/1.22.5/libexec/src/go/types/sizes.go:333
  go/types.representableConst.func1({0xdc4618?, 0x12c7080?})
  	/home/linuxbrew/.linuxbrew/Cellar/go/1.22.5/libexec/src/go/types/const.go:76 +0x9e
  go/types.representableConst({0xdcaa50, 0x[129](https://github.com/Homebrew/homebrew-core/actions/runs/10045258917/job/27762262326?pr=178113#step:4:130)1f60}, 0xc0005e6a00, 0x12c7080, 0x0)
  	/home/linuxbrew/.linuxbrew/Cellar/go/1.22.5/libexec/src/go/types/const.go:92 +0x192
  go/types.(*Checker).arrayLength(0xc0005e6a00, {0xdc8ca0, 0xc001510400?})
  	/home/linuxbrew/.linuxbrew/Cellar/go/1.22.5/libexec/src/go/types/typexpr.go:510 +0x2d3
  go/types.(*Checker).typInternal(0xc0005e6a00, {0xdc72c0, 0xc0015094a0}, 0x0)
  	/home/linuxbrew/.linuxbrew/Cellar/go/1.22.5/libexec/src/go/types/typexpr.go:299 +0x49d
  go/types.(*Checker).definedType(0xc0005e6a00, {0xdc72c0, 0xc0015094a0}, 0xc000057328?)
  	/home/linuxbrew/.linuxbrew/Cellar/go/1.22.5/libexec/src/go/types/typexpr.go:180 +0x37
  go/types.(*Checker).varType(0xc0005e6a00, {0xdc72c0, 0xc0015094a0})
  	/home/linuxbrew/.linuxbrew/Cellar/go/1.22.5/libexec/src/go/types/typexpr.go:145 +0x25
  go/types.(*Checker).structType(0xc0005e6a00, 0xc001522d80, 0xc001522d80?)
  	/home/linuxbrew/.linuxbrew/Cellar/go/1.22.5/libexec/src/go/types/struct.go:113 +0x19f
  go/types.(*Checker).typInternal(0xc0005e6a00, {0xdc7230, 0xc0015050c8}, 0xc001521400)
  	/home/linuxbrew/.linuxbrew/Cellar/go/1.22.5/libexec/src/go/types/typexpr.go:316 +0x[134](https://github.com/Homebrew/homebrew-core/actions/runs/10045258917/job/27762262326?pr=178113#step:4:135)5
  go/types.(*Checker).definedType(0xc0005e6a00, {0xdc7230, 0xc0015050c8}, 0xc927a8?)
  	/home/linuxbrew/.linuxbrew/Cellar/go/1.22.5/libexec/src/go/types/typexpr.go:180 +0x37
  go/types.(*Checker).typeDecl(0xc0005e6a00, 0xc001521400, 0xc00150af00, 0x0)
  	/home/linuxbrew/.linuxbrew/Cellar/go/1.22.5/libexec/src/go/types/decl.go:615 +0x44d
  go/types.(*Checker).objDecl(0xc0005e6a00, {0xdd0000, 0xc001521400}, 0x0)
  	/home/linuxbrew/.linuxbrew/Cellar/go/1.22.5/libexec/src/go/types/decl.go:197 +0xa7f
  go/types.(*Checker).packageObjects(0xc0005e6a00)
  	/home/linuxbrew/.linuxbrew/Cellar/go/1.22.5/libexec/src/go/types/resolver.go:681 +0x425
  go/types.(*Checker).checkFiles(0xc0005e6a00, {0xc0011f57a0, 0x3, 0x3})
  	/home/linuxbrew/.linuxbrew/Cellar/go/1.22.5/libexec/src/go/types/check.go:408 +0x1a5
  go/types.(*Checker).Files(...)
  	/home/linuxbrew/.linuxbrew/Cellar/go/1.22.5/libexec/src/go/types/check.go:372
  sigs.k8s.io/controller-tools/pkg/loader.(*loader).typeCheck(0xc00024b380, 0xc000364000)
  	/home/linuxbrew/.cache/Homebrew/go_mod_cache/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/loader.go:286 +0x36a
  sigs.k8s.io/controller-tools/pkg/loader.(*Package).NeedTypesInfo(0xc000364000)
  	/home/linuxbrew/.cache/Homebrew/go_mod_cache/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/loader.go:99 +0x39
  sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check(0xc000a54b40, 0xc000364000)
  	/home/linuxbrew/.cache/Homebrew/go_mod_cache/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:268 +0x2b7
  sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check.func1(0x68?)
  	/home/linuxbrew/.cache/Homebrew/go_mod_cache/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 70
  	/home/linuxbrew/.cache/Homebrew/go_mod_cache/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:260 +0x1c5
  make: *** [Makefile:104: generate] Error 2
  Error: failed to create API: unable to run post-scaffold tasks of "base.go.kubebuilder.io/v4": exit status 2

in logs: https://github.com/Homebrew/homebrew-core/actions/runs/10045258917/job/27762262326?pr=178113

Environment

Operator type:

Kubernetes cluster type:

$ operator-sdk version

1.35.0

$ go version (if language is Go)

1.22

$ kubectl version

Possible Solution

Additional context

Go 1.21 is supported (=getting security fixes) only until August 2024 when Go 1.23 is expected to be released. It would make sense to add support for Go 1.22 or even 1.23 by then (Go 1.23 release candidates are already available).

stefanb avatar Jul 23 '24 04:07 stefanb

Relates: https://github.com/operator-framework/operator-sdk/issues/6730

Neo2308 avatar Jul 25 '24 07:07 Neo2308

What's needed to make this happen? Go 1.21 is no longer supported by Google, and we're starting to run into dependency conflicts with other packages who have already upgraded.

siggimoo avatar Oct 07 '24 15:10 siggimoo

Hi @siggimoo If you follow the below issue

  • #6730

the items in this list are what is needed to update to go 1.22. Right now a few folks are working on the ansible-operator-plugin to resolve dependency issues, move to UBI9, then we can update that to project to the next version of kubebuilder/k8s there. After that we can then work on migrating operator-sdk to the next version of kubebuilder/k8s/UBI9.

acornett21 avatar Oct 07 '24 22:10 acornett21