1 # Test that go vet's caching of vet tool actions replays
2 # the recorded stderr output even after a cache hit.
3
4 [short] skip 'uses a fresh build cache'
5
6 # Set up fresh GOCACHE.
7 env GOCACHE=$WORK/gocache
8
9 # First time is a cache miss.
10 ! go vet example.com/a
11 stderr 'fmt.Sprint call has possible Printf formatting directive'
12
13 # Second time is assumed to be a cache hit for the stdout JSON,
14 # but we don't bother to assert it. Same diagnostics again.
15 ! go vet example.com/a
16 stderr 'fmt.Sprint call has possible Printf formatting directive'
17
18 # Vetting example.com/a only as a dependency of example.com/b
19 # records facts but reports no diagnostics. A later
20 # 'go vet example.com/a' must not reuse that result.
21 env GOCACHE=$WORK/gocache2
22 go vet example.com/b
23 ! go vet example.com/a
24 stderr 'fmt.Sprint call has possible Printf formatting directive'
25
26 -- go.mod --
27 module example.com
28
29 -- a/a.go --
30 package a
31
32 import "fmt"
33
34 var _ = fmt.Sprint("%s") // oops!
35
36 -- b/b.go --
37 package b
38
39 import _ "example.com/a"
40
View as plain text