aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/dist/build.go15
-rw-r--r--src/cmd/dist/test.go3
-rw-r--r--src/cmd/go/testdata/script/gopath_std_vendor.txt4
-rw-r--r--src/cmd/go/testdata/script/list_std.txt2
-rw-r--r--src/cmd/go/testdata/script/mod_list_std.txt12
-rw-r--r--src/cmd/go/testdata/script/mod_std_vendor.txt17
-rw-r--r--src/cmd/go/testdata/script/std_vendor.txt6
-rw-r--r--src/cmd/vet/all/whitelist/s390x.txt7
8 files changed, 46 insertions, 20 deletions
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 {
diff --git a/src/cmd/go/testdata/script/gopath_std_vendor.txt b/src/cmd/go/testdata/script/gopath_std_vendor.txt
index 8bb1dc4430..a0a41a50de 100644
--- a/src/cmd/go/testdata/script/gopath_std_vendor.txt
+++ b/src/cmd/go/testdata/script/gopath_std_vendor.txt
@@ -9,8 +9,8 @@ stdout $GOPATH[/\\]src[/\\]vendor
# to the package 'vendor/golang.org/x/net/http2/hpack' within GOROOT.
cd importnethttp
go list -deps -f '{{.ImportPath}} {{.Dir}}'
-stdout ^internal/x/net/http2/hpack
-stdout $GOROOT[/\\]src[/\\]internal[/\\]x[/\\]net[/\\]http2[/\\]hpack
+stdout ^vendor/golang.org/x/net/http2/hpack
+stdout $GOROOT[/\\]src[/\\]vendor[/\\]golang.org[/\\]x[/\\]net[/\\]http2[/\\]hpack
! stdout $GOPATH[/\\]src[/\\]vendor
# In the presence of $GOPATH/src/vendor/golang.org/x/net/http2/hpack,
diff --git a/src/cmd/go/testdata/script/list_std.txt b/src/cmd/go/testdata/script/list_std.txt
index 5960d442e5..deddaa61ea 100644
--- a/src/cmd/go/testdata/script/list_std.txt
+++ b/src/cmd/go/testdata/script/list_std.txt
@@ -16,7 +16,7 @@ stdout cmd/compile
# In GOPATH mode, packages vendored into GOROOT should be reported as standard.
go list -f '{{if .Standard}}{{.ImportPath}}{{end}}' std cmd
-stdout internal/x/net/http2/hpack
+stdout golang.org/x/net/http2/hpack
stdout cmd/vendor/golang\.org/x/arch/x86/x86asm
# However, vendored packages should not match wildcard patterns beginning with cmd.
diff --git a/src/cmd/go/testdata/script/mod_list_std.txt b/src/cmd/go/testdata/script/mod_list_std.txt
index 15642cd0b7..f5136a5de0 100644
--- a/src/cmd/go/testdata/script/mod_list_std.txt
+++ b/src/cmd/go/testdata/script/mod_list_std.txt
@@ -5,7 +5,7 @@ env GOPROXY=off
# Outside of GOROOT, our vendored packages should be reported as part of the standard library.
go list -f '{{if .Standard}}{{.ImportPath}}{{end}}' std cmd
-stdout ^internal/x/net/http2/hpack
+stdout ^vendor/golang.org/x/net/http2/hpack
stdout ^cmd/vendor/golang\.org/x/arch/x86/x86asm
# cmd/... should match the same packages it used to match in GOPATH mode.
@@ -20,15 +20,15 @@ stdout ^cmd/compile
# Today, they are listed in 'std' but not './...'.
cd $GOROOT/src
go list ./...
-stdout ^internal/x
+! stdout ^vendor/golang.org/x # TODO: should be included, or should be omitted from 'std'.
cp stdout $WORK/listdot.txt
go list std
-stdout ^internal/x
+stdout ^vendor/golang.org/x # TODO: remove vendor/ prefix
# TODO: cmp stdout $WORK/listdot.txt
go list all
-stdout ^internal/x
+stdout ^vendor/golang.org/x # TODO: remove vendor/ prefix.
! stdout ^std/
@@ -37,11 +37,11 @@ stdout ^internal/x
# TODO(golang.org/issue/30241): Make that work.
# Today, they still have the vendor/ prefix.
go list std
-stdout ^internal/x/net/http2/hpack # TODO
+stdout ^vendor/golang.org/x/net/http2/hpack # TODO
! stdout ^golang.org/x/net/http2/hpack # TODO
go list -deps -f '{{if not .Standard}}{{.ImportPath}}{{end}}' std
-# ! stdout ^internal/x/net/http2/hpack # TODO
+# ! stdout ^vendor/golang.org/x/net/http2/hpack # TODO
! stdout ^golang.org/x/net/http2/hpack # TODO
diff --git a/src/cmd/go/testdata/script/mod_std_vendor.txt b/src/cmd/go/testdata/script/mod_std_vendor.txt
index 17818c4536..5aa544cb77 100644
--- a/src/cmd/go/testdata/script/mod_std_vendor.txt
+++ b/src/cmd/go/testdata/script/mod_std_vendor.txt
@@ -1,17 +1,20 @@
env GO111MODULE=on
env GOPROXY=off
+[!gc] skip
+
+# 'go list' should report imports from _test.go in the TestImports field.
go list -f '{{.TestImports}}'
stdout net/http # from .TestImports
# 'go list' should find standard-vendored packages.
-go list -f '{{.Dir}}' internal/x/net/http2/hpack
-stdout $GOROOT[/\\]src[/\\]internal
+go list -f '{{.Dir}}' vendor/golang.org/x/net/http2/hpack
+stdout $GOROOT[/\\]src[/\\]vendor
# 'go list -test' should report vendored transitive dependencies of _test.go
# imports in the Deps field.
go list -test -f '{{range .Deps}}{{.}}{{"\n"}}{{end}}'
-stdout internal/x/crypto # dep of .TestImports
+stdout ^vendor/golang.org/x/crypto # dep of .TestImports
# Modules outside the standard library should not use the packages vendored there...
@@ -29,7 +32,7 @@ stderr 'use of vendored package'
cd ../importstd
! go build .
-stderr 'use of internal package'
+stderr 'use of vendored package'
# When run within the 'std' module, 'go list -test' should report vendored
@@ -38,8 +41,8 @@ stderr 'use of internal package'
# Today, they're standard packages as long as they exist.
cd $GOROOT/src
go list -test -f '{{range .Deps}}{{.}}{{"\n"}}{{end}}' net/http
-! stdout ^vendor/golang.org/x/net/http2/hpack # TODO: this will exist later
-stdout ^internal/x/net/http2/hpack
+stdout ^vendor/golang.org/x/net/http2/hpack # TODO: remove vendor/ prefix
+! stdout ^golang.org/x/net/http2/hpack
-- go.mod --
module m
@@ -74,4 +77,4 @@ module importvendor
-- importstd/x.go --
package importstd
-import _ "internal/x/net/http2/hpack"
+import _ "vendor/golang.org/x/net/http2/hpack"
diff --git a/src/cmd/go/testdata/script/std_vendor.txt b/src/cmd/go/testdata/script/std_vendor.txt
index e769dff481..6cb015fc07 100644
--- a/src/cmd/go/testdata/script/std_vendor.txt
+++ b/src/cmd/go/testdata/script/std_vendor.txt
@@ -7,13 +7,13 @@ go list -f '{{.TestImports}}'
stdout net/http # from .TestImports
# 'go list' should report standard-vendored packages by path.
-go list -f '{{.Dir}}' internal/x/net/http2/hpack
-stdout $GOROOT[/\\]src[/\\]internal
+go list -f '{{.Dir}}' vendor/golang.org/x/net/http2/hpack
+stdout $GOROOT[/\\]src[/\\]vendor
# 'go list -test' should report vendored transitive dependencies of _test.go
# imports in the Deps field, with a 'vendor' prefix on their import paths.
go list -test -f '{{.Deps}}'
-stdout internal/x/crypto # dep of .TestImports
+stdout golang.org/x/crypto # dep of .TestImports
# Packages outside the standard library should not use its copy of vendored packages.
cd broken
diff --git a/src/cmd/vet/all/whitelist/s390x.txt b/src/cmd/vet/all/whitelist/s390x.txt
index 55cf44a519..c8fd385c4a 100644
--- a/src/cmd/vet/all/whitelist/s390x.txt
+++ b/src/cmd/vet/all/whitelist/s390x.txt
@@ -10,3 +10,10 @@ internal/cpu/cpu_s390x.s: [s390x] kmctrQuery: invalid MOVD of ret+0(FP); interna
internal/cpu/cpu_s390x.s: [s390x] kmaQuery: invalid MOVD of ret+0(FP); internal/cpu.queryResult is 16-byte value
internal/cpu/cpu_s390x.s: [s390x] kimdQuery: invalid MOVD of ret+0(FP); internal/cpu.queryResult is 16-byte value
internal/cpu/cpu_s390x.s: [s390x] klmdQuery: invalid MOVD of ret+0(FP); internal/cpu.queryResult is 16-byte value
+vendor/golang.org/x/sys/cpu/cpu_s390x.s: [s390x] stfle: invalid MOVD of ret+0(FP); vendor/golang.org/x/sys/cpu.facilityList is 32-byte value
+vendor/golang.org/x/sys/cpu/cpu_s390x.s: [s390x] kmQuery: invalid MOVD of ret+0(FP); vendor/golang.org/x/sys/cpu.queryResult is 16-byte value
+vendor/golang.org/x/sys/cpu/cpu_s390x.s: [s390x] kmcQuery: invalid MOVD of ret+0(FP); vendor/golang.org/x/sys/cpu.queryResult is 16-byte value
+vendor/golang.org/x/sys/cpu/cpu_s390x.s: [s390x] kmctrQuery: invalid MOVD of ret+0(FP); vendor/golang.org/x/sys/cpu.queryResult is 16-byte value
+vendor/golang.org/x/sys/cpu/cpu_s390x.s: [s390x] kmaQuery: invalid MOVD of ret+0(FP); vendor/golang.org/x/sys/cpu.queryResult is 16-byte value
+vendor/golang.org/x/sys/cpu/cpu_s390x.s: [s390x] kimdQuery: invalid MOVD of ret+0(FP); vendor/golang.org/x/sys/cpu.queryResult is 16-byte value
+vendor/golang.org/x/sys/cpu/cpu_s390x.s: [s390x] klmdQuery: invalid MOVD of ret+0(FP); vendor/golang.org/x/sys/cpu.queryResult is 16-byte value