summaryrefslogtreecommitdiffhomepage
path: root/pull-toolchain.sh
blob: eb8febf6bb32d636e9f7059958ba98bce6ac9276 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh
# Retrieve the latest Go toolchain.
#
set -eu
cd "$(dirname "$0")"

read -r go_branch <go.toolchain.branch
upstream=$(git ls-remote https://github.com/tailscale/go "$go_branch" | awk '{print $1}')
current=$(cat go.toolchain.rev)
if [ "$upstream" != "$current" ]; then
	echo "$upstream" >go.toolchain.rev
fi

./tool/go version 2>/dev/null | awk '{print $3}' | sed 's/^go//' > go.toolchain.version

./update-flake.sh

if [ -n "$(git diff-index --name-only HEAD -- go.toolchain.rev go.toolchain.rev.sri go.toolchain.version)" ]; then
    echo "pull-toolchain.sh: changes imported. Use git commit to make them permanent." >&2
fi