ci: pin GOROOT to active go #7
@@ -98,12 +98,23 @@ jobs:
|
||||
# a matching toolchain and never needs to download one.
|
||||
go-version-file: backend/go.mod
|
||||
|
||||
# The self-hosted runner keeps a persistent Go build cache. A prior run
|
||||
# under a different (auto-downloaded) toolchain left objects that mismatch
|
||||
# the pinned toolchain ("compile: version ... does not match go tool
|
||||
# version"). Clear it so everything recompiles with this toolchain.
|
||||
- name: Clean Go build cache
|
||||
run: go clean -cache
|
||||
# The self-hosted runner has a stale global GOROOT pointing at a different
|
||||
# Go install, so `go` (from setup-go) invokes a mismatched `compile`
|
||||
# ("compile: version ... does not match go tool version"). Pin GOROOT to
|
||||
# the directory of the active go binary for all later steps, and clear the
|
||||
# persistent build cache so objects recompile with this toolchain.
|
||||
- name: Align Go toolchain
|
||||
run: |
|
||||
set -euo pipefail
|
||||
GO_BIN="$(command -v go)"
|
||||
GR="$(cd "$(dirname "$GO_BIN")/.." && pwd)"
|
||||
echo "active go: $GO_BIN"
|
||||
echo "env GOROOT (before): ${GOROOT:-unset}"
|
||||
echo "resolved GOROOT: $GR"
|
||||
echo "GOROOT=$GR" >> "$GITHUB_ENV"
|
||||
GOROOT="$GR" go version
|
||||
GOROOT="$GR" go tool compile -V || true
|
||||
GOROOT="$GR" go clean -cache
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
|
||||
Reference in New Issue
Block a user