Skip to content

cmd/vet: build tag checks running in vetxonly mode #26102

@rsc

Description

@rsc

When we "go test" t1, and t1 imports t2, we run vet in vetx-only mode on t2 to compute any vet-specific export data. That vetx-only run is not supposed to report problems with t2. But it is:

$ cd $GOPATH/src/t1
$ ls
t1_test.go
$ cat t1_test.go
package t1

import _ "t2"
$ ls ../t2
t2x.go	t2y.go
$ cat ../t2/t2x.go
package t2
$ cat ../t2/t2y.go
// +build !foo-bar

package t2
$ go1.10 test
testing: warning: no tests to run
PASS
ok  	t1	0.013s
$ go test
# t2
../t2/t2y.go:1: invalid non-alphanumeric build constraint: [!foo-bar]
testing: warning: no tests to run
PASS
ok  	t1	0.012s
$ go test
testing: warning: no tests to run
PASS
ok  	t1	0.012s
$ go test -a
# t2
../t2/t2y.go:1: invalid non-alphanumeric build constraint: [!foo-bar]
testing: warning: no tests to run
PASS
ok  	t1	0.012s
$ 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions