1 # ensure all runs non-default vet
2 ! go test -vet=all ./vetall/...
3 stderr 'using resp before checking for errors'
4
5 # Test issue #47309
6 ! go test -vet=bools,xyz ./vetall/...
7 stderr '-vet argument must be a supported analyzer'
8
9 # Test with a single analyzer
10 ! go test -vet=httpresponse ./vetall/...
11 stderr 'using resp before checking for errors'
12
13 # Test with a list of analyzers
14 go test -vet=atomic,bools,nilfunc ./vetall/...
15 stdout 'm/vetall.*\[no tests to run\]'
16
17 -- go.mod --
18 module m
19
20 go 1.16
21 -- vetall/p.go --
22 package p
23
24 import "net/http"
25
26 func F() {
27 resp, err := http.Head("example.com")
28 defer resp.Body.Close()
29 if err != nil {
30 panic(err)
31 }
32 // (defer statement belongs here)
33 }
34 -- vetall/p_test.go --
35 package p
36
View as plain text