From c5cf6624076a644906aa7ec5c91c4e01ccd375d3 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Fri, 1 Mar 2019 10:12:30 -0500 Subject: all: move internal/x to vendor/golang.org/x and revendor using 'go mod vendor' This also updates the vendored-in versions of several packages: 'go mod vendor' selects a consistent version of each module, but we had previously vendored an ad-hoc selection of packages. Notably, x/crypto/hkdf was previously vendored in at a much newer commit than the rest of x/crypto. Bringing the rest of x/crypto up to that commit introduced an import of golang.org/x/sys/cpu, which broke the js/wasm build, requiring an upgrade of x/sys to pick up CL 165749. Updates #30228 Updates #30241 Updates #25822 Change-Id: I5b3dbc232b7e6a048a158cbd8d36137af1efb711 Reviewed-on: https://go-review.googlesource.com/c/go/+/164623 Reviewed-by: Filippo Valsorda --- src/cmd/dist/build.go | 15 +++++++++++++++ src/cmd/dist/test.go | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src/cmd/dist') diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index 87739a510d..c31d36acae 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -192,6 +192,21 @@ func xinit() { gogcflags = os.Getenv("BOOT_GO_GCFLAGS") + // Add -mod=vendor to GOFLAGS so that commands won't try to resolve go.mod + // files for vendored external modules. + // TODO(golang.org/issue/30240): If the vendor directory contains the go.mod + // files, this probably won't be necessary. + // TODO(golang.org/issue/26849): Escape spaces in GOFLAGS if needed. + goflags := strings.Fields(os.Getenv("GOFLAGS")) + for i, flag := range goflags { + if strings.HasPrefix(flag, "-mod=") { + goflags = append(goflags[0:i], goflags[i+1:]...) + break + } + } + goflags = append(goflags, "-mod=vendor") + os.Setenv("GOFLAGS", strings.Join(goflags, " ")) + cc, cxx := "gcc", "g++" if defaultclang { cc, cxx = "clang", "clang++" diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index a58cee7518..1a54752f35 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -419,9 +419,10 @@ func (t *tester) registerTests() { if !t.race { cmd.Args = append(cmd.Args, "cmd") } + cmd.Stderr = new(bytes.Buffer) all, err := cmd.Output() if err != nil { - log.Fatalf("Error running go list std cmd: %v, %s", err, all) + log.Fatalf("Error running go list std cmd: %v:\n%s", err, cmd.Stderr) } pkgs := strings.Fields(string(all)) for _, pkg := range pkgs { -- cgit v1.3