8 func foo(s string) int { return 0 }
14 const s1 = "a string value"
15 var s2 = "a string value"
18 var id1 = "a string value"
20 if strings.HasPrefix(id1, s1) { // want `should replace.*with.*strings\.TrimPrefix`
24 if strings.HasPrefix(id1, s1) { // want `should replace.*with.*strings\.TrimPrefix`
25 id1 = strings.TrimPrefix(id1, s1)
28 if strings.HasPrefix(id1, s1) {
29 id1 = strings.TrimPrefix(id1, s2)
32 if strings.Contains(id1, s1) { // want `should replace.*with.*strings\.Replace`
33 id1 = strings.Replace(id1, s1, "something", 123)
36 if strings.HasSuffix(id1, s2) { // want `should replace.*with.*strings\.TrimSuffix`
37 id1 = id1[:len(id1)-len(s2)]
42 if strings.HasPrefix(x[i], s1) { // want `should replace.*with.*strings\.TrimPrefix`
46 if strings.HasPrefix(x[i], y[i]) { // want `should replace.*with.*strings\.TrimPrefix`
47 x[i] = x[i][len(y[i]):]
50 var t struct{ x string }
51 if strings.HasPrefix(t.x, s1) { // want `should replace.*with.*strings\.TrimPrefix`
55 if strings.HasPrefix(id1, "test") { // want `should replace.*with.*strings\.TrimPrefix`
56 id1 = id1[len("test"):]
59 if strings.HasPrefix(id1, "test") { // want `should replace.*with.*strings\.TrimPrefix`
63 if strings.HasPrefix(id1, s1) { // want `should replace.*with.*strings\.TrimPrefix`
67 if strings.HasPrefix(id1, s1) { // want `should replace.*with.*strings\.TrimPrefix`
72 if bytes.HasPrefix(b1, b2) { // want `should replace.*with.*bytes\.TrimPrefix`
77 if strings.HasPrefix(id1, id3) { // want `should replace.*with.*strings\.TrimPrefix`
81 if strings.HasSuffix(id1, s2) {
82 id1 = id1[:len(id1)+len(s2)] // wrong operator
85 if strings.HasSuffix(id1, s2) {
86 id1 = id1[:len(s2)-len(id1)] // wrong math
89 if strings.HasSuffix(id1, s2) {
90 id1 = id1[:len(id1)-len(id1)] // wrong string length
93 if strings.HasPrefix(id1, gen()) {
94 id1 = id1[len(gen()):] // dynamic id3
97 if strings.HasPrefix(id1, s1) {
98 id1 = id1[foo(s1):] // wrong function
101 if strings.HasPrefix(id1, s1) {
102 id1 = id1[len(id1):] // len() on wrong value
105 if strings.HasPrefix(id1, "test") {
106 id1 = id1[5:] // wrong length
109 if strings.HasPrefix(id1, s1) {
110 id1 = id1[len(s1)+1:] // wrong length due to math
113 if strings.HasPrefix(id1, s1) {
114 id2 = id1[len(s1):] // assigning to the wrong variable
117 if strings.HasPrefix(id1, s1) {
118 id1 = id1[len(s1):15] // has a max
121 if strings.HasPrefix(id1, s1) {
122 id1 = id2[len(s1):] // assigning the wrong value
125 if strings.HasPrefix(id1, s1) {
127 id1 += "" // doing more work in the if
130 if strings.HasPrefix(id1, s1) {
133 id1 = "game over" // else branch
136 if strings.HasPrefix(id1, s1) {
137 // the conditional is guarding additional code