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:
179179 // delete "= expr"
180180 edits = append (edits , analysis.TextEdit {
181181 Pos : init ,
182- End : decl .End (),
182+ End : spec .End (),
183183 })
184184 }
185185
Original file line number Diff line number Diff line change @@ -88,3 +88,14 @@ func _(x string) string {
8888 }
8989 return s
9090}
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 {
9393 }
9494 return s
9595}
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