crossplane-contrib / provider-jet-template

A template for building terrajet based @crossplane providers
Apache License 2.0
14 stars 12 forks source link

add support for golang 1.18 and 1.19 #29

Open raffaelespazzoli opened 1 year ago

raffaelespazzoli commented 1 year ago

What problem are you facing?

panic error during make generate

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0x1294e56]

goroutine 1 [running]:
github.com/crossplane/terrajet/pkg/types.init.0()
    /home/rspazzol/git/crossplane-github-provider/.work/pkg/pkg/mod/github.com/crossplane/terrajet@v0.4.0-rc.0.0.20220510203225-5e7094f2ea5c/pkg/types/reference.go:73 +0x116
exit status 2
apis/generate.go:33: running "go": exit status 1
06:50:29 [FAIL]
make[1]: *** [build/makelib/golang.mk:271: go.generate] Error 1
make: *** [build/makelib/common.mk:419: generate] Error 2

How could Template Provider help solve your problem?

this error does not happen with go 1.17, it seems to happen with following versions of go 1.18 and 1.19. template provider should be tested with those versions of go, or upgraded to them.

displague commented 1 year ago

I also ran into this problem. https://github.com/crossplane/terrajet/pull/291 seems to correct it.

After that, I ran into another Go 1.18 problem:

ERRO Running error: buildir: failed to load package goarch: could not load export data: cannot import "internal/goarch" (unknown iexport format version 2), export data is newer version - update tool

This is resolved by adding GOLANGCILINT_VERSION ?= 1.48.0 to the Makefile (the version from upbound/build is older)

raffaelespazzoli commented 1 year ago

I'm also getting this error:

/bin/bash: line 1: /home/rspazzol/git/provider-jet-github/.cache/tools/linux_x86_64/goimports: No such file or directory
make[1]: *** [build/makelib/golang.mk:271: go.generate] Error 127
make: *** [build/makelib/common.mk:419: generate] Error 2

the make file should download the needed tools automatically but it doesn't for reasons I can't understand. running go install golang.org/x/tools/cmd/goimports@latest does not seem to fix the issue.