File tree 4 files changed +32
-3
lines changed 4 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -699,7 +699,7 @@ Run go tool vet on packages
699
699
700
700
Usage:
701
701
702
- go vet [-n] [-x] [packages]
702
+ go vet [-n] [-x] [build flags] [ packages]
703
703
704
704
Vet runs the Go vet command on the packages named by the import paths.
705
705
@@ -711,6 +711,8 @@ To run the vet tool with specific options, run 'go tool vet'.
711
711
The -n flag prints commands that would be executed.
712
712
The -x flag prints commands as they are executed.
713
713
714
+ For more about build flags, see 'go help build'.
715
+
714
716
See also: go fmt, go fix.
715
717
716
718
Original file line number Diff line number Diff line change @@ -1290,6 +1290,22 @@ fi
1290
1290
unset GOPATH
1291
1291
rm -rf $d
1292
1292
1293
+ TEST go vet with -tags
1294
+ d=$( mktemp -d -t testgoXXX)
1295
+ export GOPATH=$d
1296
+ ./testgo get golang.org/x/tools/cmd/vet
1297
+ export GOPATH=$( pwd) /testdata
1298
+ if ./testgo vet -tags tagtest vetpkg > $d /err 2>&1 ; then
1299
+ echo " go vet vetpkg passes incorrectly"
1300
+ ok=false
1301
+ elif ! grep -q ' c\.go.*wrong number of args for format' $d /err; then
1302
+ echo " go vet vetpkg did not scan tagged file"
1303
+ cat $d /err
1304
+ ok=false
1305
+ fi
1306
+ unset GOPATH
1307
+ rm -rf $d
1308
+
1293
1309
TEST go get ./rsc.io/toolstash ' (golang.org/issue/9767)'
1294
1310
d=$( TMPDIR=/var/tmp mktemp -d -t testgoXXX)
1295
1311
export GOPATH=$d
Original file line number Diff line number Diff line change
1
+ // +build tagtest
2
+
3
+ package p
4
+
5
+ import "fmt"
6
+
7
+ func g () {
8
+ fmt .Printf ("%d" , 3 , 4 )
9
+ }
Original file line number Diff line number Diff line change @@ -7,12 +7,12 @@ package main
7
7
import "path/filepath"
8
8
9
9
func init () {
10
- addBuildFlagsNX (cmdVet )
10
+ addBuildFlags (cmdVet )
11
11
}
12
12
13
13
var cmdVet = & Command {
14
14
Run : runVet ,
15
- UsageLine : "vet [-n] [-x] [packages]" ,
15
+ UsageLine : "vet [-n] [-x] [build flags] [ packages]" ,
16
16
Short : "run go tool vet on packages" ,
17
17
Long : `
18
18
Vet runs the Go vet command on the packages named by the import paths.
@@ -25,6 +25,8 @@ To run the vet tool with specific options, run 'go tool vet'.
25
25
The -n flag prints commands that would be executed.
26
26
The -x flag prints commands as they are executed.
27
27
28
+ For more about build flags, see 'go help build'.
29
+
28
30
See also: go fmt, go fix.
29
31
` ,
30
32
}
You can’t perform that action at this time.
0 commit comments