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