|
467 | 467 | },
|
468 | 468 | {
|
469 | 469 | "Name": "\"modernize\"",
|
470 |
| - "Doc": "simplify code by using modern constructs\n\nThis analyzer reports opportunities for simplifying and clarifying\nexisting code by using more modern features of Go, such as:\n\n - replacing if/else conditional assignments by a call to the\n built-in min or max functions.\n - replacing sort.Slice(x, func(i, j int) bool) { return s[i] \u003c s[j] }\n by slices.Sort(s).", |
| 470 | + "Doc": "simplify code by using modern constructs\n\nThis analyzer reports opportunities for simplifying and clarifying\nexisting code by using more modern features of Go, such as:\n\n - replacing if/else conditional assignments by a call to the\n built-in min or max functions added in go1.21;\n - replacing sort.Slice(x, func(i, j int) bool) { return s[i] \u003c s[j] }\n by a call to slices.Sort(s), added in go1.21;\n - replacing interface{} by the 'any' type added in go1.18;", |
471 | 471 | "Default": "true"
|
472 | 472 | },
|
473 | 473 | {
|
|
605 | 605 | "Doc": "checks for unused writes\n\nThe analyzer reports instances of writes to struct fields and\narrays that are never read. Specifically, when a struct object\nor an array is copied, its elements are copied implicitly by\nthe compiler, and any element write to this copy does nothing\nwith the original object.\n\nFor example:\n\n\ttype T struct { x int }\n\n\tfunc f(input []T) {\n\t\tfor i, v := range input { // v is a copy\n\t\t\tv.x = i // unused write to field x\n\t\t}\n\t}\n\nAnother example is about non-pointer receiver:\n\n\ttype T struct { x int }\n\n\tfunc (t T) f() { // t is a copy\n\t\tt.x = i // unused write to field x\n\t}",
|
606 | 606 | "Default": "true"
|
607 | 607 | },
|
608 |
| - { |
609 |
| - "Name": "\"useany\"", |
610 |
| - "Doc": "check for constraints that could be simplified to \"any\"", |
611 |
| - "Default": "false" |
612 |
| - }, |
613 | 608 | {
|
614 | 609 | "Name": "\"waitgroup\"",
|
615 | 610 | "Doc": "check for misuses of sync.WaitGroup\n\nThis analyzer detects mistaken calls to the (*sync.WaitGroup).Add\nmethod from inside a new goroutine, causing Add to race with Wait:\n\n\t// WRONG\n\tvar wg sync.WaitGroup\n\tgo func() {\n\t wg.Add(1) // \"WaitGroup.Add called from inside new goroutine\"\n\t defer wg.Done()\n\t ...\n\t}()\n\twg.Wait() // (may return prematurely before new goroutine starts)\n\nThe correct code calls Add before starting the goroutine:\n\n\t// RIGHT\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\t...\n\t}()\n\twg.Wait()",
|
|
1138 | 1133 | },
|
1139 | 1134 | {
|
1140 | 1135 | "Name": "modernize",
|
1141 |
| - "Doc": "simplify code by using modern constructs\n\nThis analyzer reports opportunities for simplifying and clarifying\nexisting code by using more modern features of Go, such as:\n\n - replacing if/else conditional assignments by a call to the\n built-in min or max functions.\n - replacing sort.Slice(x, func(i, j int) bool) { return s[i] \u003c s[j] }\n by slices.Sort(s).", |
| 1136 | + "Doc": "simplify code by using modern constructs\n\nThis analyzer reports opportunities for simplifying and clarifying\nexisting code by using more modern features of Go, such as:\n\n - replacing if/else conditional assignments by a call to the\n built-in min or max functions added in go1.21;\n - replacing sort.Slice(x, func(i, j int) bool) { return s[i] \u003c s[j] }\n by a call to slices.Sort(s), added in go1.21;\n - replacing interface{} by the 'any' type added in go1.18;", |
1142 | 1137 | "URL": "https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/modernize",
|
1143 | 1138 | "Default": true
|
1144 | 1139 | },
|
|
1304 | 1299 | "URL": "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/unusedwrite",
|
1305 | 1300 | "Default": true
|
1306 | 1301 | },
|
1307 |
| - { |
1308 |
| - "Name": "useany", |
1309 |
| - "Doc": "check for constraints that could be simplified to \"any\"", |
1310 |
| - "URL": "https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/useany", |
1311 |
| - "Default": false |
1312 |
| - }, |
1313 | 1302 | {
|
1314 | 1303 | "Name": "waitgroup",
|
1315 | 1304 | "Doc": "check for misuses of sync.WaitGroup\n\nThis analyzer detects mistaken calls to the (*sync.WaitGroup).Add\nmethod from inside a new goroutine, causing Add to race with Wait:\n\n\t// WRONG\n\tvar wg sync.WaitGroup\n\tgo func() {\n\t wg.Add(1) // \"WaitGroup.Add called from inside new goroutine\"\n\t defer wg.Done()\n\t ...\n\t}()\n\twg.Wait() // (may return prematurely before new goroutine starts)\n\nThe correct code calls Add before starting the goroutine:\n\n\t// RIGHT\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\t...\n\t}()\n\twg.Wait()",
|
|
0 commit comments