@@ -35,6 +35,13 @@ if [[ ! -v GOPATH ]]; then
3535 fi
3636fi
3737
38+ # Pinned tool versions
39+ readonly GUM_VERSION=" v0.14.1"
40+ readonly GOTESTSUM_VERSION=" v1.13.0"
41+ readonly GOTESTFMT_VERSION=" v2.5.0"
42+ readonly TERMINAL_TO_HTML_VERSION=" v3.10.0"
43+ readonly GO_LICENSES_VERSION=" v2.0.1"
44+
3845# Useful environment variables
3946[[ -v PROW_JOB_ID ]] && IS_PROW=1 || IS_PROW=0
4047readonly IS_PROW
@@ -265,7 +272,7 @@ function gum_banner() {
265272
266273# Simple info banner for logging purposes.
267274function gum_style() {
268- go_run github.com/charmbracelet/gum@v0.14.1 style " $@ "
275+ go_run " github.com/charmbracelet/gum@${GUM_VERSION} " style " $@ "
269276}
270277
271278# Checks whether the given function exists.
@@ -588,7 +595,7 @@ function report_go_test() {
588595 logfile=" ${logfile/ .xml/ .jsonl} "
589596 echo " Running go test with args: ${go_test_args[*]} "
590597 local gotest_retcode=0
591- go_run gotest.tools/gotestsum@v1.13.0 \
598+ go_run " gotest.tools/gotestsum@${GOTESTSUM_VERSION} " \
592599 --format " ${GO_TEST_VERBOSITY:- testname} " \
593600 --junitfile " ${xml} " \
594601 --junitfile-testsuite-name relative \
@@ -601,14 +608,14 @@ function report_go_test() {
601608 echo " Test log (JSONL) written to ${logfile} "
602609
603610 ansilog=" ${logfile/ .jsonl/ -ansi.log} "
604- go_run github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@v2.5.0 \
611+ go_run " github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@${GOTESTFMT_VERSION} " \
605612 -input " ${logfile} " \
606613 -showteststatus \
607614 -nofail > " $ansilog "
608615 echo " Test log (ANSI) written to ${ansilog} "
609616
610617 htmllog=" ${logfile/ .jsonl/ .html} "
611- go_run github.com/buildkite/terminal-to-html/v3/cmd/terminal-to-html@v3.10.0 \
618+ go_run " github.com/buildkite/terminal-to-html/v3/cmd/terminal-to-html@${TERMINAL_TO_HTML_VERSION} " \
612619 --preview < " $ansilog " > " $htmllog "
613620 echo " Test log (HTML) written to ${htmllog} "
614621
@@ -921,13 +928,14 @@ function run_kntest() {
921928}
922929
923930# Run go-licenses to check for forbidden licenses.
931+ # Extra flags can be passed via the GO_LICENSES_FLAGS environment variable.
924932function check_licenses() {
925933 # Pin GOTOOLCHAIN to the project's Go version so that go-licenses is
926934 # compiled with the same toolchain. GOTOOLCHAIN=auto (the go_run default)
927935 # may select a different Go, causing isStdLib() path mismatches.
928936 GOTOOLCHAIN=" $( go env GOVERSION) " \
929- go_run github.com/google/go-licenses/v2@v2.0.1 \
930- check " ${REPO_ROOT_DIR} /..." || \
937+ go_run " github.com/google/go-licenses/v2@${GO_LICENSES_VERSION} " \
938+ check ${GO_LICENSES_FLAGS :- } " ${REPO_ROOT_DIR} /..." || \
931939 { echo " --- FAIL: go-licenses failed the license check" ; return 1; }
932940}
933941
0 commit comments