| 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) //@ diag(`http.StatusVariantAlsoNegotiates`) |
| 9 |
http.Redirect(nil, nil, "", 506) //@ diag(`http.StatusVariantAlsoNegotiates`) |
| 10 |
http.StatusText(506) //@ diag(`http.StatusVariantAlsoNegotiates`) |
| 11 |
http.RedirectHandler("", 506) //@ diag(`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 |
|
| 22 |
http.Error(fn2()) |
| 23 |
} |
| 24 |
|
| 25 |
func fn2() (http.ResponseWriter, string, int) { return nil, "", 0 } |