gitee.com/wgliang/goreporter@v0.0.0-20180902115603-df1b20f7c5d0/linters/simplecode/testdata/LintStringCopy.go (about) 1 package pkg 2 3 func fn(s string) { 4 _ = string([]byte(s)) // MATCH "should use s instead of string([]byte(s))" 5 _ = "" + s // MATCH /should use s instead of "" \+ s/ 6 _ = s + "" // MATCH /should use s instead of s \+ ""/ 7 8 _ = s 9 _ = s + "foo" 10 _ = s == "" 11 _ = s != "" 12 _ = "" + 13 "really long lines follow" + 14 "that need pretty formatting" 15 16 _ = string([]rune(s)) 17 { 18 string := func(v interface{}) string { 19 return "foo" 20 } 21 _ = string([]byte(s)) 22 } 23 { 24 type byte rune 25 _ = string([]byte(s)) 26 } 27 { 28 type T []byte 29 var x T 30 _ = string([]byte(x)) 31 } 32 }