Skip to content

Commit

Permalink
pkgsite: prepare for go 1.18
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
jba committed Feb 4, 2022
1 parent 6b165ee commit 4d836c6
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions all.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

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

GO=go

# Support ** in globs, for check_script_hashes.
shopt -s globstar
Expand Down Expand Up @@ -90,14 +91,14 @@ findcode() {
}

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

Expand Down Expand Up @@ -140,7 +141,7 @@ check_unparam() {

# check_vet runs go vet on source files.
check_vet() {
runcmd go vet -all ./...
runcmd $GO vet -all ./...
}

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

# run_build_static builds JavaScript output from TypeScript source files.
run_build_static() {
runcmd go run ./devtools/cmd/static
runcmd $GO run ./devtools/cmd/static
}

run_npm() {
Expand Down Expand Up @@ -272,9 +273,9 @@ main() {
run_prettier
run_npm run lint -- --fix
run_npm run test
runcmd go mod tidy
runcmd $GO mod tidy
runcmd env GO_DISCOVERY_TESTDB=true go test ./...
runcmd go test ./internal/secrets
runcmd $GO test ./internal/secrets
run_npm audit
;;
cl)
Expand Down Expand Up @@ -306,9 +307,9 @@ main() {
run_npm run lint -- --fix
run_npm run test
fi
runcmd go mod tidy
runcmd $GO mod tidy
runcmd env GO_DISCOVERY_TESTDB=true go test ./...
runcmd go test ./internal/secrets
runcmd $GO test ./internal/secrets
;;

ci)
Expand All @@ -325,13 +326,13 @@ main() {
echo "DONE: $((end-start)) seconds"
echo "--------------------"

for pkg in $(go list ./...); do
for pkg in $($GO list ./...); do
if [[ ${no_race[$pkg]} = '' ]]; then
race="$race $pkg"
fi
done
runcmd env GO_DISCOVERY_TESTDB=true go test -race -count=1 $race
runcmd env GO_DISCOVERY_TESTDB=true go test -count=1 ${!no_race[*]}
runcmd env GO_DISCOVERY_TESTDB=true $GO test -race -count=1 $race
runcmd env GO_DISCOVERY_TESTDB=true $GO test -count=1 ${!no_race[*]}
;;
lint) standard_linters ;;
headers) check_headers ;;
Expand Down

0 comments on commit 4d836c6

Please sign in to comment.