aboutsummaryrefslogtreecommitdiff
path: root/src/internal/testenv
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2019-03-08 13:26:04 -0500
committerBryan C. Mills <bcmills@google.com>2019-03-08 23:40:24 +0000
commit0271d41ed63cacd1d79716161d0797790e930dfa (patch)
treed66cb17b4bd0cf6dea4c789f3b6f78b40daa8215 /src/internal/testenv
parent632162ccbc61a7321f322b1b99c04aefc414802b (diff)
downloadgo-0271d41ed63cacd1d79716161d0797790e930dfa.tar.xz
internal/testenv: remove SetModVendor
It turns out not to be necessary. Russ expressed a preference for avoiding module fetches over making 'go mod tidy' work within std and cmd right away, so for now we will make the loader use the vendor directory for the standard library even if '-mod=vendor' is not set explicitly. Updates #30228 Change-Id: Idf7208e63da8cb7bfe281b93ec21b61d40334947 Reviewed-on: https://go-review.googlesource.com/c/go/+/166357 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/internal/testenv')
-rw-r--r--src/internal/testenv/testenv.go26
1 files changed, 0 insertions, 26 deletions
diff --git a/src/internal/testenv/testenv.go b/src/internal/testenv/testenv.go
index 72e4d803cb..8f69fe0da5 100644
--- a/src/internal/testenv/testenv.go
+++ b/src/internal/testenv/testenv.go
@@ -19,7 +19,6 @@ import (
"runtime"
"strconv"
"strings"
- "sync"
"testing"
)
@@ -78,31 +77,6 @@ func MustHaveGoRun(t testing.TB) {
}
}
-var modVendorOnce sync.Once
-
-// SetModVendor adds the "-mod=vendor" flag to the GOFLAGS environment variable.
-// This allows tests whose working directories are within the cmd and std
-// modules to run ``go'' commands without accessing the network to load
-// dependencies modules.
-//
-// SetModVendor must be called before any test may read the GOFLAGS environment
-// variable.
-//
-// TODO(golang.org/issue/30240): If we load go.mod files from vendor/
-// automatically, this will probably no longer be necessary.
-func SetModVendor() {
- modVendorOnce.Do(func() {
- var goflags []string
- for _, f := range strings.Fields(os.Getenv("GOFLAGS")) {
- if !strings.HasPrefix(f, "-mod=") && !strings.HasPrefix(f, "--mod=") {
- goflags = append(goflags, f)
- }
- }
- goflags = append(goflags, "-mod=vendor")
- os.Setenv("GOFLAGS", strings.Join(goflags, " "))
- })
-}
-
// GoToolPath reports the path to the Go tool.
// It is a convenience wrapper around GoTool.
// If the tool is unavailable GoToolPath calls t.Skip.