File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ #
3+ # Copyright 2025 Crunchy Data Solutions, Inc.
4+ #
5+ # SPDX-License-Identifier: Apache-2.0
6+ #
7+ # This runs `$GO get` without changing the "go" directive in the "go.mod" file.
8+ # To change that, pass a "go@go{version}" argument.
9+ #
10+ # https://go.dev/doc/toolchain
11+ #
12+ # Usage: $0 help
13+ # Usage: $0 -u golang.org/x/crypto
14+ # Usage: $0 -u golang.org/x/crypto go@go1.99.0
15+ #
16+
17+ set -eu
18+ : " ${GO:= go} "
19+
20+ if [[ " $# " -eq 0 ]] || [[ " $1 " == ' help' ]] || [[ " $* " == * ' --help' * ]] || [[ " $* " == * ' --version' * ]]
21+ then
22+ self=$( command -v -- " $0 " )
23+ content=$( < " ${self} " )
24+ content=" ${content%% $' \n\n ' * } "
25+ content=" #${content#* $' \n #' } "
26+ content=" ${content// $' $GO' / ${GO} } "
27+ exec echo " ${content// $' $0' / $0 } "
28+ fi
29+
30+ version=$( ${GO} list -m -f ' go@go{{.GoVersion}}' )
31+
32+ for arg in " $@ "
33+ do case " ${arg} " in go@go* ) version=" ${arg} " ;; * ) esac
34+ done
35+
36+ ${GO} get " $@ " " ${version} " ' toolchain@none'
37+ ${GO} mod tidy
You can’t perform that action at this time.
0 commit comments