Commit 133beb8
go/analysis/passes/modernize: modernizer for iterator APIs
This CL adds the stditerators modernizer, which replaces loops
of the form
for i := 0; i < x.Len(); i++ {
use(x.At(i))
}
or their "range x.Len()" equivalent by
for elem := range x.All() {
use(x.At(i)
}
for various well-known std types.
Publishing each new Analyzer symbol requires going through the
proposal process, so we plan to do them in one batch per Go
release. In the interim, we cannot make such symbols public,
so we use a backdoor mechanism to export them to gopls.
+ test, doc, relnote
Updates golang/go#75693
Change-Id: I3accd1925ad990b84500a9e77c3c589aeaeabfb0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/708775
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>1 parent 077f385 commit 133beb8
File tree
12 files changed
+580
-9
lines changed- gopls
- doc
- release
- internal
- doc
- settings
- go/analysis/passes/modernize
- testdata/src/stditerators
- internal/goplsexport
12 files changed
+580
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
| 120 | + | |
| 121 | + | |
129 | 122 | | |
130 | 123 | | |
131 | 124 | | |
| |||
238 | 231 | | |
239 | 232 | | |
240 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
273 | 292 | | |
274 | 293 | | |
275 | 294 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
| |||
0 commit comments