diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index 0287af7b3b2..d0f07dec43c 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -1036,7 +1036,7 @@ func (b *Builder) vet(a *Action) error { // There's too much unsafe.Pointer code // that vet doesn't like in low-level packages // like runtime, sync, and reflect. - vetFlags = []string{"-unsafeptr=false"} + vetFlags = append(vetFlags, string("-unsafeptr=false")) } // Note: We could decide that vet should compute export data for diff --git a/src/cmd/go/testdata/script/vet_flags.txt b/src/cmd/go/testdata/script/vet_flags.txt new file mode 100644 index 00000000000..d84c8a6472f --- /dev/null +++ b/src/cmd/go/testdata/script/vet_flags.txt @@ -0,0 +1,8 @@ +env GO111MODULE=off + +# Issue 35837. Verify that "go vet - " works if 'pwd' is not $GOROOT/src +# we utilize the package runtime/testdata/testprog as the issue is specific to vetting standard package + +go vet -n -unreachable=false runtime/testdata/testprog +stderr '-unreachable=false' +stderr '-unsafeptr=false'