hashicorp / vault

A tool for secrets management, encryption as a service, and privileged access management
https://www.vaultproject.io/
Other
31.19k stars 4.21k forks source link

Can't compile with go 1.18.1 #23544

Closed innerdev closed 1 year ago

innerdev commented 1 year ago

I got the following error when compiling:

~/go/src/github.com/hashicorp/vault$ make bootstrap 
Installing/Updating golang.org/x/tools/cmd/goimports
Installing/Updating github.com/golangci/revgrep/cmd/revgrep
Installing/Updating mvdan.cc/gofumpt
# mvdan.cc/gofumpt/internal/govendor/go/printer
../../../mvdan.cc/gofumpt/internal/govendor/go/printer/comment.go:40:28: undefined: strings.CutPrefix
Installing/Updating honnef.co/go/tools/cmd/staticcheck
# honnef.co/go/tools/go/ir
../../../honnef.co/go/tools/go/ir/methods.go:119:19: obj.Origin undefined (type *types.Func has no field or method Origin)
../../../honnef.co/go/tools/go/ir/source.go:171:12: obj.Origin undefined (type *types.Func has no field or method Origin)
Installing/Updating github.com/bufbuild/buf/cmd/buf
# go.uber.org/multierr
../../../go.uber.org/multierr/error.go:209:20: undefined: atomic.Bool
# go.opentelemetry.io/otel/internal/global
../../../go.opentelemetry.io/otel/internal/global/handler.go:44:18: undefined: atomic.Pointer
../../../go.opentelemetry.io/otel/internal/global/internal_logging.go:30:25: undefined: atomic.Pointer
# github.com/klauspost/compress/zstd
../../klauspost/compress/zstd/dict.go:479:32: binary.LittleEndian.AppendUint32 undefined (type binary.littleEndian has no field or method AppendUint32)
../../klauspost/compress/zstd/dict.go:490:32: binary.LittleEndian.AppendUint32 undefined (type binary.littleEndian has no field or method AppendUint32)
../../klauspost/compress/zstd/dict.go:491:32: binary.LittleEndian.AppendUint32 undefined (type binary.littleEndian has no field or method AppendUint32)
../../klauspost/compress/zstd/dict.go:492:32: binary.LittleEndian.AppendUint32 undefined (type binary.littleEndian has no field or method AppendUint32)
# github.com/tetratelabs/wazero/internal/wasm
../../tetratelabs/wazero/internal/wasm/store.go:115:17: undefined: atomic.Uint64
# connectrpc.com/connect
../../../connectrpc.com/connect/error.go:405:24: undefined: http.MaxBytesError
make: *** [Makefile:172: .ci-bootstrap] Ошибка 2

Go version (just installed):

$ go version
go version go1.18.1 linux/amd64

PATH:

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/bin:/home/dev/go/bin

GOPATH:

$ echo $GOPATH
/home/dev/go

System:

$ uname -a
Linux q 6.5.0-1003-oem #3-Ubuntu SMP PREEMPT_DYNAMIC Mon Aug 28 15:04:22 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Any ideas, guys?

divyaac commented 1 year ago

Hi @innerdev , I believe you will need go 1.20 in order to compile vault.

rraj-splunk commented 1 year ago

@innerdev @divyaac : I face the exact same issue , even though i am on go 1.21. Is there a solution ?

raskchanky commented 1 year ago

I tried this as well, first on my MBP: CleanShot 2023-10-16 at 15 50 28

And next on my linux box: CleanShot 2023-10-16 at 15 52 37

It does indeed fail with 1.18.1. The file located here https://github.com/hashicorp/vault/blob/main/.go-version specifies the minimum Go version that should be used to compile Vault. That is referenced as part of the Makefile here https://github.com/hashicorp/vault/blob/main/Makefile#L165 where a shell script checks to make sure you're using the minimum required Go version when building Vault.

make bootstrap, for reasons I'm not entirely clear about, does not perform this minimum check, but I can ensure that's the case.

@rraj-splunk I'm not sure why you're experiencing problems if you're using Go 1.21. It works for me on both macOS and Linux using Go 1.21. Can you post more details on what errors out?

raskchanky commented 1 year ago

https://github.com/hashicorp/vault/pull/23685 should help avoid problems like this going forward.