Skip to content

Commit 4d836c6

Browse files
committed
pkgsite: prepare for go 1.18
For golang/go#48264 Change-Id: I55e512051450fb4bbc58fe00872c5d7077988ccb Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/382974 Trust: Jonathan Amsterdam <[email protected]> Run-TryBot: Jonathan Amsterdam <[email protected]> Reviewed-by: Jamal Carvalho <[email protected]> TryBot-Result: kokoro <[email protected]>
1 parent 6b165ee commit 4d836c6

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

all.bash

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
source devtools/lib.sh || { echo "Are you at repo root?"; exit 1; }
77

8+
GO=go
89

910
# Support ** in globs, for check_script_hashes.
1011
shopt -s globstar
@@ -90,14 +91,14 @@ findcode() {
9091
}
9192

9293
# ensure_go_binary verifies that a binary exists in $PATH corresponding to the
93-
# given go-gettable URI. If no such binary exists, it is fetched via `go get`.
94+
# given go-gettable URI. If no such binary exists, it is fetched via `go install`.
9495
ensure_go_binary() {
9596
local binary=$(basename $1)
9697
if ! [ -x "$(command -v $binary)" ]; then
9798
info "Installing: $1"
9899
# Run in a subshell for convenience, so that we don't have to worry about
99100
# our PWD.
100-
(set -x; cd && go install $1@latest)
101+
(set -x; cd && $GO install $1@latest)
101102
fi
102103
}
103104

@@ -140,7 +141,7 @@ check_unparam() {
140141

141142
# check_vet runs go vet on source files.
142143
check_vet() {
143-
runcmd go vet -all ./...
144+
runcmd $GO vet -all ./...
144145
}
145146

146147
# check_staticcheck runs staticcheck on source files.
@@ -174,12 +175,12 @@ script_hash_glob='static/**/*.tmpl'
174175
# check_script_hashes checks that our CSP hashes match the ones
175176
# for our HTML scripts.
176177
check_script_hashes() {
177-
runcmd go run ./devtools/cmd/csphash $script_hash_glob
178+
runcmd $GO run ./devtools/cmd/csphash $script_hash_glob
178179
}
179180

180181
# run_build_static builds JavaScript output from TypeScript source files.
181182
run_build_static() {
182-
runcmd go run ./devtools/cmd/static
183+
runcmd $GO run ./devtools/cmd/static
183184
}
184185

185186
run_npm() {
@@ -272,9 +273,9 @@ main() {
272273
run_prettier
273274
run_npm run lint -- --fix
274275
run_npm run test
275-
runcmd go mod tidy
276+
runcmd $GO mod tidy
276277
runcmd env GO_DISCOVERY_TESTDB=true go test ./...
277-
runcmd go test ./internal/secrets
278+
runcmd $GO test ./internal/secrets
278279
run_npm audit
279280
;;
280281
cl)
@@ -306,9 +307,9 @@ main() {
306307
run_npm run lint -- --fix
307308
run_npm run test
308309
fi
309-
runcmd go mod tidy
310+
runcmd $GO mod tidy
310311
runcmd env GO_DISCOVERY_TESTDB=true go test ./...
311-
runcmd go test ./internal/secrets
312+
runcmd $GO test ./internal/secrets
312313
;;
313314

314315
ci)
@@ -325,13 +326,13 @@ main() {
325326
echo "DONE: $((end-start)) seconds"
326327
echo "--------------------"
327328

328-
for pkg in $(go list ./...); do
329+
for pkg in $($GO list ./...); do
329330
if [[ ${no_race[$pkg]} = '' ]]; then
330331
race="$race $pkg"
331332
fi
332333
done
333-
runcmd env GO_DISCOVERY_TESTDB=true go test -race -count=1 $race
334-
runcmd env GO_DISCOVERY_TESTDB=true go test -count=1 ${!no_race[*]}
334+
runcmd env GO_DISCOVERY_TESTDB=true $GO test -race -count=1 $race
335+
runcmd env GO_DISCOVERY_TESTDB=true $GO test -count=1 ${!no_race[*]}
335336
;;
336337
lint) standard_linters ;;
337338
headers) check_headers ;;

0 commit comments

Comments
 (0)