github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/simple/s1035/testdata/src/example.com/CheckRedundantCanonicalHeaderKey/LintRedundantCanonicalHeaderKey.go (about) 1 package pkg 2 3 import ( 4 "net/http" 5 "strings" 6 ) 7 8 func fn1() { 9 var headers http.Header 10 11 // Matches 12 headers.Add(http.CanonicalHeaderKey("test"), "test") //@ diag(`calling net/http.CanonicalHeaderKey on the 'key' argument of`) 13 headers.Del(http.CanonicalHeaderKey("test")) //@ diag(`calling net/http.CanonicalHeaderKey on the 'key' argument of`) 14 headers.Get(http.CanonicalHeaderKey("test")) //@ diag(`calling net/http.CanonicalHeaderKey on the 'key' argument of`) 15 headers.Set(http.CanonicalHeaderKey("test"), "test") //@ diag(`calling net/http.CanonicalHeaderKey on the 'key' argument of`) 16 17 // Non-matches 18 headers.Add("test", "test") 19 headers.Del("test") 20 headers.Get("test") 21 headers.Set("test", "test") 22 23 headers.Add("test", http.CanonicalHeaderKey("test")) 24 headers.Set("test", http.CanonicalHeaderKey("test")) 25 26 headers.Add(http.CanonicalHeaderKey("test")+"1", "test") 27 headers.Del(http.CanonicalHeaderKey("test") + "1") 28 headers.Get(http.CanonicalHeaderKey("test") + "1") 29 headers.Set(http.CanonicalHeaderKey("test")+"1", "test") 30 31 headers.Add(strings.ToUpper(http.CanonicalHeaderKey("test")), "test") 32 headers.Del(strings.ToUpper(http.CanonicalHeaderKey("test"))) 33 headers.Get(strings.ToUpper(http.CanonicalHeaderKey("test"))) 34 headers.Set(strings.ToUpper(http.CanonicalHeaderKey("test")), "test") 35 }