github.com/golangci/go-tools@v0.0.0-20190318060251-af6baa5dc196/stylecheck/testdata/src/CheckHTTPStatusCodes/CheckHTTPStatusCodes.go (about)

     1  // Package pkg ...
     2  package pkg
     3  
     4  import "net/http"
     5  
     6  func fn() {
     7  	// Check all the supported functions
     8  	http.Error(nil, "", 506)         // MATCH "http.StatusVariantAlsoNegotiates"
     9  	http.Redirect(nil, nil, "", 506) // MATCH "http.StatusVariantAlsoNegotiates"
    10  	http.StatusText(506)             // MATCH "http.StatusVariantAlsoNegotiates"
    11  	http.RedirectHandler("", 506)    // MATCH "http.StatusVariantAlsoNegotiates"
    12  
    13  	// Don't flag literals with no known constant
    14  	http.StatusText(600)
    15  
    16  	// Don't flag constants
    17  	http.StatusText(http.StatusAccepted)
    18  
    19  	// Don't flag items on the whitelist (well known codes)
    20  	http.StatusText(404)
    21  }