From 59eee83beb8bd7433cb64149efcee4ee95333981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sun, 15 Jun 2025 18:16:51 +0100 Subject: [PATCH] clarify why TestScript sets GONOSUMDB (#958) And unset it in gotoolchain.txtar, as that one testscript does fetch modules from the real proxy.golang.org. Closes #950. --- main_test.go | 3 ++- testdata/script/gotoolchain.txtar | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/main_test.go b/main_test.go index 8898887..1a313df 100644 --- a/main_test.go +++ b/main_test.go @@ -90,7 +90,8 @@ func TestScript(t *testing.T) { } env.Setenv("HOST_GOMODCACHE", strings.TrimSpace(string(out))) - // We use our own proxy, so avoid sum.golang.org. + // We use our own GOPROXY above, so avoid using sum.golang.org, + // as we would fail to update any go.sum file in the testscripts. env.Setenv("GONOSUMDB", "*") // "go build" starts many short-lived Go processes, diff --git a/testdata/script/gotoolchain.txtar b/testdata/script/gotoolchain.txtar index ee8cea1..6c73123 100644 --- a/testdata/script/gotoolchain.txtar +++ b/testdata/script/gotoolchain.txtar @@ -15,8 +15,11 @@ setup-go ${GOVERSION_BASE} # We want to use the real GOPROXY so that we can download the newer # toolchain, and we use the host's GOMODCACHE so we can reuse it. +# Unset GONOSUMDB to get its default value, as TestScript's setup func +# sets it to "*" to not use sum.golang.org with the testdata/mod modules. env GOPROXY=proxy.golang.org env GOMODCACHE=${HOST_GOMODCACHE} +env GONOSUMDB= # Verify that we are using an older version of Go. exec go version