CI runner has no Go: checks.install fetches Go 1.22.12 (sha256-verified) into .tools/go; lint/test/build use it. gofmt runs over module package dirs so it skips the toolchain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
931 B
Bash
Executable File
21 lines
931 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Ставит Go нужной версии в .tools/go (для CI и машин без Go). Повторный запуск — no-op.
|
|
set -euo pipefail
|
|
GO_VERSION=1.22.12
|
|
dest="$(cd "$(dirname "$0")/.." && pwd)/.tools"
|
|
if [[ -x "$dest/go/bin/go" ]] && "$dest/go/bin/go" version | grep -q "go$GO_VERSION "; then
|
|
exit 0
|
|
fi
|
|
case "$(uname -m)" in
|
|
x86_64|amd64) arch=amd64; sum=4fa4f869b0f7fc6bb1eb2660e74657fbf04cdd290b5aef905585c86051b34d43 ;;
|
|
aarch64|arm64) arch=arm64; sum=fd017e647ec28525e86ae8203236e0653242722a7436929b1f775744e26278e7 ;;
|
|
*) echo "install-go: неподдерживаемая архитектура $(uname -m)" >&2; exit 1 ;;
|
|
esac
|
|
tmp=$(mktemp)
|
|
trap 'rm -f "$tmp"' EXIT
|
|
curl -fsSL -o "$tmp" "https://go.dev/dl/go$GO_VERSION.linux-$arch.tar.gz"
|
|
echo "$sum $tmp" | sha256sum -c - >/dev/null
|
|
rm -rf "$dest/go" && mkdir -p "$dest"
|
|
tar -xzf "$tmp" -C "$dest"
|
|
"$dest/go/bin/go" version
|