intel / trustauthority-client-for-go

BSD 3-Clause "New" or "Revised" License
16 stars 18 forks source link

`make cli` fails with go version v1.21 on RHEL 9.3 #29

Closed anjalirai-intel closed 3 months ago

anjalirai-intel commented 4 months ago

As per README, go requirement is v1.19 or newer

Go Requirement Requires Go 1.19 or newer. See https://go.dev/doc/install for installation of Go.

By default, RHEL package manager install go version v1.21, but when we run the command make cli it fails with error go: go.mod requires go >= 1.22 (running go 1.21.9; GOTOOLCHAIN=local)

make cli
CGO_CFLAGS="-O2 -D_FORTIFY_SOURCE=2" go build -buildmode=pie -trimpath -ldflags "-s -linkmode=external -extldflags -Wl,-O1,-z,relro,-z,now \
    -X github.com/intel/trustauthority-client/tdx-cli/cmd.Version=v1.4.0 -X github.com/intel/trustauthority-client/tdx-cli/cmd.BuildDate=2024-04-19 \
    -X github.com/intel/trustauthority-client/tdx-cli/cmd.GitHash=9bcf69c" -o trustauthority-cli
go: go.mod requires go >= 1.22 (running go 1.21.9; GOTOOLCHAIN=local)
make: *** [Makefile:10: cli] Error 1

Resolution: Install GO v1.22 from sources.

wget https://go.dev/dl/go1.22.2.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.22.2.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin