Skip to content

Commit b3a7f7f

Browse files
committed
tool/go: update to correct toolchain as needed
Ensure that the target revision is loaded from this repository, not from the working directory. Update go to the target revision if the marker file does not match the target. Updates #501 Signed-off-by: James Tucker <[email protected]>
1 parent 209045d commit b3a7f7f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tool/go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ if [[ "${CI:-}" == "true" && "${NOBASHDEBUG:-}" != "true" ]]; then
88
set -x
99
fi
1010

11+
tsandroid=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd )
12+
1113
# Allow TOOLCHAINDIR to be overridden, as a special case for the fdroid build
1214
if [[ -z "${TOOLCHAINDIR}" ]]; then
1315
toolchain="$HOME/.cache/tailscale-go"
@@ -29,10 +31,13 @@ if [[ -z "${TOOLCHAINDIR}" ]]; then
2931
rm -rf "$toolchain" "$toolchain.extracted"
3032
fi
3133
fi
32-
if [[ ! -d "$toolchain" ]]; then
33-
mkdir -p "$HOME/.cache"
3434

35-
read -r REV <go.toolchain.rev
35+
REV="$(<${tsandroid}/go.toolchain.rev)"
36+
EREV=""
37+
[[ -f ${toolchain}.extracted ]] && EREV="$(<${toolchain}.extracted)"
38+
39+
if [[ ! -d "$toolchain" || "$EREV" != "$REV" ]]; then
40+
mkdir -p "$HOME/.cache"
3641

3742
case "$REV" in
3843
/*)

0 commit comments

Comments
 (0)