Text file src/cmd/go/testdata/script/test_vet_vetall.txt

     1  [short] skip
     2  
     3  # ensure all runs non-default vet
     4  ! go test -vet=all ./vetall/...
     5  stderr 'using resp before checking for errors'
     6  
     7  # Test issue #47309
     8  ! go test -vet=bools,xyz ./vetall/...
     9  stderr '-vet argument must be a supported analyzer'
    10  
    11  # Test with a single analyzer
    12  ! go test -vet=httpresponse ./vetall/...
    13  stderr 'using resp before checking for errors'
    14  
    15  # Test with a list of analyzers
    16  go test -vet=atomic,bools,nilfunc ./vetall/...
    17  stdout 'm/vetall.*\[no tests to run\]'
    18  
    19  -- go.mod --
    20  module m
    21  
    22  go 1.16
    23  -- vetall/p.go --
    24  package p
    25  
    26  import "net/http"
    27  
    28  func 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 --
    37  package p
    38  

View as plain text