-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
Following the official guidelines to create a custom provider, all the steps can be run until go generate.
then, go generate panics with a backtrace
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=0x5f1f4f]
goroutine 182 [running]:
go/types.(*Checker).handleBailout(0xc00033d600, 0xc0006d[9](https://github.com/tjamet/test-crossplane-provider-template/actions/runs/8351040741/job/22858659459#step:7:10)c60)
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/check.go:367 +0x88
panic({0x7a47a0?, 0xac2140?})
/opt/hostedtoolcache/go/1.22.1/x64/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0x888760, 0xac6320})
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/sizes.go:228 +0x30f
go/types.(*Config).sizeof(...)
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/sizes.go:333
go/types.representableConst.func1({0x888760?, 0xac6320?})
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/const.go:76 +0x9e
go/types.representableConst({0x88a520, 0xab96e0}, 0xc00033d600, 0xac6320, 0xc0006d8078)
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/const.go:92 +0x192
go/types.(*Checker).representation(0xc00033d600, 0xc0006e9[10](https://github.com/tjamet/test-crossplane-provider-template/actions/runs/8351040741/job/22858659459#step:7:11)0, 0xac6320)
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/const.go:256 +0x65
go/types.(*Checker).implicitTypeAndValue(0xc00033d600, 0xc0006e9100, {0x888760, 0xac6320})
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/expr.go:375 +0x2d7
go/types.(*Checker).convertUntyped(0xc00033d600, 0xc0006e9100, {0x888760, 0xac6320})
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/const.go:289 +0x3f
go/types.(*Checker).matchTypes(0xc00033d600, 0xc0006e90c0, 0xc0006e9100)
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/expr.go:926 +0x79
go/types.(*Checker).binary(0xc00033d600, 0xc0006e90c0, {0x889570, 0xc0006db590}, {0x889600, 0xc0006e6ea0}, {0x889b40, 0xc0006e6ec0}, 0x28, 0x3c109)
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/expr.go:800 +0x166
go/types.(*Checker).exprInternal(0xc00033d600, 0x0, 0xc0006e90c0, {0x889570, 0xc0006db590}, {0x0, 0x0})
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/expr.go:1416 +0x206
go/types.(*Checker).rawExpr(0xc00033d600, 0x0, 0xc0006e90c0, {0x889570?, 0xc0006db590?}, {0x0?, 0x0?}, 0x0)
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).expr(0xc00033d600, 0x888a58?, 0xc0006e90c0, {0x889570?, 0xc0006db590?})
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/expr.go:1513 +0x30
go/types.(*Checker).stmt(0xc00033d600, 0x0, {0x889960, 0xc0006e8380})
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/stmt.go:570 +0x[11](https://github.com/tjamet/test-crossplane-provider-template/actions/runs/8351040741/job/22858659459#step:7:12)f2
go/types.(*Checker).stmtList(0xc00033d600, 0x0, {0xc0006e7020?, 0x0?, 0x0?})
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/stmt.go:[12](https://github.com/tjamet/test-crossplane-provider-template/actions/runs/8351040741/job/22858659459#step:7:13)1 +0x85
go/types.(*Checker).funcBody(0xc00033d600, 0x888760?, {0xc0006dc700?, 0xac6500?}, 0xc0006e8e00, 0xc0006db620, {0x0?, 0x0?})
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/stmt.go:41 +0x331
go/types.(*Checker).funcDecl.func1()
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/decl.go:852 +0x3a
go/types.(*Checker).processDelayed(0xc00033d600, 0x0)
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/check.go:467 +0x[16](https://github.com/tjamet/test-crossplane-provider-template/actions/runs/8351040741/job/22858659459#step:7:17)2
go/types.(*Checker).checkFiles(0xc00033d600, {0xc0000b04[20](https://github.com/tjamet/test-crossplane-provider-template/actions/runs/8351040741/job/22858659459#step:7:21), 0x1, 0x1})
/opt/hostedtoolcache/go/1.[22](https://github.com/tjamet/test-crossplane-provider-template/actions/runs/8351040741/job/22858659459#step:7:23).1/x64/src/go/types/check.go:411 +0x1cc
go/types.(*Checker).Files(...)
/opt/hostedtoolcache/go/1.22.1/x64/src/go/types/check.go:372
golang.org/x/tools/go/packages.(*loader).loadPackage(0xc0001[24](https://github.com/tjamet/test-crossplane-provider-template/actions/runs/8351040741/job/22858659459#step:7:25)000, 0xc00044b340)
/home/runner/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:1001 +0x76f
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
/home/runner/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:838 +0x1a9
sync.(*Once).doSlow(0x0?, 0x0?)
/opt/hostedtoolcache/go/1.22.1/x64/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
/opt/hostedtoolcache/go/1.22.1/x64/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
/home/runner/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:8[26](https://github.com/tjamet/test-crossplane-provider-template/actions/runs/8351040741/job/22858659459#step:7:27) +0x4a
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
/home/runner/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:833 +0x26
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 79
/home/runner/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:8[32](https://github.com/tjamet/test-crossplane-provider-template/actions/runs/8351040741/job/22858659459#step:7:33) +0x94
Error: Process completed with exit code 2.
How can we reproduce it?
The problem can be easily reproduced on github action workers.
Here is a workflow reproducing the problem:
name: Go
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]
jobs:
build:
continue-on-error: true
strategy:
fail-fast: false
matrix:
version: [20, 21, 22]
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.${{ matrix.version }}'
- name: Install CLI
run: go install github.com/crossplane/crossplane-tools/cmd/angryjet@master
- name: Build
run: |
git clone https://github.com/crossplane/provider-template.git
cd provider-template
make submodules
export provider_name=MyProvider
make provider.prepare provider=${provider_name}
export group=sample
export type=MyType
make provider.addtype provider=${provider_name} group=${group} kind=${type}
- name: generate
run: |
cd provider-template
make generate
- name: go run angryjet
if: always()
run: |
cd provider-template
(
cd apis
go run -tags generate github.com/crossplane/crossplane-tools/cmd/angryjet generate-methodsets --header-file=../hack/boilerplate.go.txt ./...
)
- name: call angryjet
if: always()
run: |
cd provider-template
(
cd apis
angryjet generate-methodsets --header-file=../hack/boilerplate.go.txt ./...
)
As we can see in this run, the build works well for go 1.20 and 1.21.
It though fails on go 1.22 regardless the way the angryjet command is called (make generate, go run or locally build command)
What environment did it happen in?
Crossplane version: Not required
I could reproduce the error locally as well as in github actions using ubuntu-latest
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working