Skip to content

Commit 2815c8b

Browse files
adonovangopherbot
authored andcommitted
internal/tokeninternal: tag AddExistingFiles for go1.24
...and use FileSet.AddExistingFiles in go1.25. This change is necessary so that CL 675736, which changes the representation of FileSet, can be merged. Updates golang/go#73205 Change-Id: Ic2815130c17b7cadd3d7b55076ad8482c508c3c7 Reviewed-on: https://go-review.googlesource.com/c/tools/+/675955 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Findley <[email protected]> Auto-Submit: Alan Donovan <[email protected]>
1 parent 389a102 commit 2815c8b

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

internal/tokeninternal/tokeninternal_go124.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// TODO(rfindley): once the new AddExistingFiles API has had some time to soak
6-
// in std, use it in x/tools and change the condition below to !go1.25.
7-
8-
//go:build !addexistingfiles
5+
//go:build !go1.25
96

107
package tokeninternal
118

@@ -22,9 +19,6 @@ import (
2219
// AddExistingFiles adds the specified files to the FileSet if they
2320
// are not already present. It panics if any pair of files in the
2421
// resulting FileSet would overlap.
25-
//
26-
// TODO(adonovan): replace with FileSet.AddExistingFiles in go1.25,
27-
// which is much more efficient.
2822
func AddExistingFiles(fset *token.FileSet, files []*token.File) {
2923

3024
// This function cannot be implemented as:

internal/tokeninternal/tokeninternal_go125.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// TODO(rfindley): once the new AddExistingFiles API has had some time to soak
6-
// in std, use it here behind the go1.25 build tag.
7-
8-
//go:build addexistingfiles
5+
//go:build go1.25
96

107
package tokeninternal
118

@@ -14,8 +11,6 @@ import "go/token"
1411
// AddExistingFiles adds the specified files to the FileSet if they
1512
// are not already present. It panics if any pair of files in the
1613
// resulting FileSet would overlap.
17-
//
18-
// TODO(adonovan): eliminate when go1.25 is always available.
1914
func AddExistingFiles(fset *token.FileSet, files []*token.File) {
2015
fset.AddExistingFiles(files...)
2116
}

0 commit comments

Comments
 (0)