File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed
gopls/internal/analysis/modernize
testdata/src/stringsbuilder Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ nextcand:
179
179
// delete "= expr"
180
180
edits = append (edits , analysis.TextEdit {
181
181
Pos : init ,
182
- End : decl .End (),
182
+ End : spec .End (),
183
183
})
184
184
}
185
185
Original file line number Diff line number Diff line change @@ -88,3 +88,14 @@ func _(x string) string {
88
88
}
89
89
return s
90
90
}
91
+
92
+ // Regression test for bug in a GenDecl with parens.
93
+ func issue75318 (slice []string ) string {
94
+ var (
95
+ msg string
96
+ )
97
+ for _ , s := range slice {
98
+ msg += s // want "using string \\+= string in a loop is inefficient"
99
+ }
100
+ return msg
101
+ }
Original file line number Diff line number Diff line change @@ -93,3 +93,14 @@ func _(x string) string {
93
93
}
94
94
return s
95
95
}
96
+
97
+ // Regression test for bug in a GenDecl with parens.
98
+ func issue75318(slice []string) string {
99
+ var (
100
+ msg strings.Builder
101
+ )
102
+ for _, s := range slice {
103
+ msg.WriteString(s) // want "using string \\+= string in a loop is inefficient"
104
+ }
105
+ return msg.String()
106
+ }
You can’t perform that action at this time.
0 commit comments