Skip to content

Commit 8b85edc

Browse files
adonovangopherbot
authored andcommitted
gopls/internal: use go1.24-isms
This CL intentionally does not include any new API covered by the modernizers, whose fixes will be submitted separately. Surprisingly few changes in all. Change-Id: I0c45ed674fd80234e7c76823a23b8b3af3011835 Reviewed-on: https://go-review.googlesource.com/c/tools/+/651376 Auto-Submit: Alan Donovan <[email protected]> Reviewed-by: Robert Findley <[email protected]> Reviewed-by: Jonathan Amsterdam <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent f95771e commit 8b85edc

File tree

3 files changed

+3
-18
lines changed

3 files changed

+3
-18
lines changed

gopls/internal/analysis/gofix/directive.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
// -- plundered from the future (CL 605517, issue #68021) --
1414

15-
// TODO(adonovan): replace with ast.Directive after go1.24 (#68021).
15+
// TODO(adonovan): replace with ast.Directive after go1.25 (#68021).
1616
// Beware of our local mods to handle analysistest
1717
// "want" comments on the same line.
1818

gopls/internal/golang/pkgdoc.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import (
3939
"go/token"
4040
"go/types"
4141
"html"
42-
"iter"
4342
"path/filepath"
4443
"slices"
4544
"strings"
@@ -666,7 +665,7 @@ window.addEventListener('load', function() {
666665
cloneTparams(sig.RecvTypeParams()),
667666
cloneTparams(sig.TypeParams()),
668667
types.NewTuple(append(
669-
slices.Collect(tupleVariables(sig.Params()))[:3],
668+
slices.Collect(sig.Params().Variables())[:3],
670669
types.NewParam(0, nil, "", types.Typ[types.Invalid]))...),
671670
sig.Results(),
672671
false) // any final ...T parameter is truncated
@@ -851,17 +850,3 @@ window.addEventListener('load', function() {
851850

852851
return buf.Bytes(), nil
853852
}
854-
855-
// tupleVariables returns a go1.23 iterator over the variables of a tuple type.
856-
//
857-
// Example: for v := range tuple.Variables() { ... }
858-
// TODO(adonovan): use t.Variables in go1.24.
859-
func tupleVariables(t *types.Tuple) iter.Seq[*types.Var] {
860-
return func(yield func(v *types.Var) bool) {
861-
for i := range t.Len() {
862-
if !yield(t.At(i)) {
863-
break
864-
}
865-
}
866-
}
867-
}

gopls/internal/test/integration/misc/references_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ var _ = unsafe.Slice(nil, 0)
126126

127127
Run(t, files, func(t *testing.T, env *Env) {
128128
env.OpenFile("a.go")
129-
for _, name := range strings.Fields(
129+
for name := range strings.FieldsSeq(
130130
"iota error int nil append iota Pointer Sizeof Alignof Add Slice") {
131131
loc := env.RegexpSearch("a.go", `\b`+name+`\b`)
132132

0 commit comments

Comments
 (0)