From: Alan Donovan Date: Thu, 25 Sep 2025 14:30:14 +0000 (-0400) Subject: cmd: update x/tools@4df13e3 X-Git-Tag: go1.26rc1~790 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=81a83bba21;p=gostls13.git cmd: update x/tools@4df13e3 This includes only a couple of minor cmd/vet fixes for new(expr). export GOWORK=off cd src/cmd go get golang.org/x/tools@4df13e3 go mod tidy go mod vendor For #45624 Change-Id: Iafba4350d321d6cd1fcc91a062e2c150e3f4d553 Reviewed-on: https://go-review.googlesource.com/c/go/+/706735 LUCI-TryBot-Result: Go LUCI Reviewed-by: Robert Findley Auto-Submit: Alan Donovan --- diff --git a/src/cmd/go.mod b/src/cmd/go.mod index c72a250aea..017883a787 100644 --- a/src/cmd/go.mod +++ b/src/cmd/go.mod @@ -11,7 +11,7 @@ require ( golang.org/x/sys v0.36.0 golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053 golang.org/x/term v0.34.0 - golang.org/x/tools v0.37.1-0.20250915202913-9fccddc465ef + golang.org/x/tools v0.37.1-0.20250924232827-4df13e317ce4 ) require ( diff --git a/src/cmd/go.sum b/src/cmd/go.sum index a4801f1843..0906ffcc60 100644 --- a/src/cmd/go.sum +++ b/src/cmd/go.sum @@ -22,7 +22,7 @@ golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= -golang.org/x/tools v0.37.1-0.20250915202913-9fccddc465ef h1:ISPkUgvOYIt0oS7oVnwAPktCKBvgWkDlWWGMgX0veZM= -golang.org/x/tools v0.37.1-0.20250915202913-9fccddc465ef/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w= +golang.org/x/tools v0.37.1-0.20250924232827-4df13e317ce4 h1:IcXDtHggZZo+GzNzvVRPyNFLnOc2/Z1gg3ZVIWF2uCU= +golang.org/x/tools v0.37.1-0.20250924232827-4df13e317ce4/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w= rsc.io/markdown v0.0.0-20240306144322-0bf8f97ee8ef h1:mqLYrXCXYEZOop9/Dbo6RPX11539nwiCNBb1icVPmw8= rsc.io/markdown v0.0.0-20240306144322-0bf8f97ee8ef/go.mod h1:8xcPgWmwlZONN1D9bjxtHEjrUtSEa3fakVF8iaewYKQ= diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/copylock/copylock.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/copylock/copylock.go index a4e455d9b3..d35b85f03a 100644 --- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/copylock/copylock.go +++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/copylock/copylock.go @@ -157,7 +157,10 @@ func checkCopyLocksCallExpr(pass *analysis.Pass, ce *ast.CallExpr) { } if fun, ok := pass.TypesInfo.Uses[id].(*types.Builtin); ok { switch fun.Name() { - case "new", "len", "cap", "Sizeof", "Offsetof", "Alignof": + case "len", "cap", "Sizeof", "Offsetof", "Alignof": + // The argument of this operation is used only + // for its type (e.g. len(array)), or the operation + // does not copy a lock (e.g. len(slice)). return } } diff --git a/src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go b/src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go index bc7f9984e9..cea89d34da 100644 --- a/src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go +++ b/src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go @@ -193,18 +193,23 @@ func CheckReadable(pass *analysis.Pass, filename string) error { return fmt.Errorf("Pass.ReadFile: %s is not among OtherFiles, IgnoredFiles, or names of Files", filename) } -// AddImport checks whether this file already imports pkgpath and -// that import is in scope at pos. If so, it returns the name under -// which it was imported and a zero edit. Otherwise, it adds a new -// import of pkgpath, using a name derived from the preferred name, -// and returns the chosen name, a prefix to be concatenated with member -// to form a qualified name, and the edit for the new import. +// AddImport checks whether this file already imports pkgpath and that +// the import is in scope at pos. If so, it returns the name under +// which it was imported and no edits. Otherwise, it adds a new import +// of pkgpath, using a name derived from the preferred name, and +// returns the chosen name, a prefix to be concatenated with member to +// form a qualified name, and the edit for the new import. // -// In the special case that pkgpath is dot-imported then member, the -// identifier for which the import is being added, is consulted. If -// member is not shadowed at pos, AddImport returns (".", "", nil). -// (AddImport accepts the caller's implicit claim that the imported -// package declares member.) +// The member argument indicates the name of the desired symbol within +// the imported package. This is needed in the case when the existing +// import is a dot import, because then it is possible that the +// desired symbol is shadowed by other declarations in the current +// package. If member is not shadowed at pos, AddImport returns (".", +// "", nil). (AddImport accepts the caller's implicit claim that the +// imported package declares member.) +// +// Use a preferredName of "_" to request a blank import; +// member is ignored in this case. // // It does not mutate its arguments. func AddImport(info *types.Info, file *ast.File, preferredName, pkgpath, member string, pos token.Pos) (name, prefix string, newImport []analysis.TextEdit) { @@ -220,6 +225,10 @@ func AddImport(info *types.Info, file *ast.File, preferredName, pkgpath, member pkgname := info.PkgNameOf(spec) if pkgname != nil && pkgname.Imported().Path() == pkgpath { name = pkgname.Name() + if preferredName == "_" { + // Request for blank import; any existing import will do. + return name, "", nil + } if name == "." { // The scope of ident must be the file scope. if s, _ := scope.LookupParent(member, pos); s == info.Scopes[file] { @@ -232,8 +241,12 @@ func AddImport(info *types.Info, file *ast.File, preferredName, pkgpath, member } // We must add a new import. + // Ensure we have a fresh name. - newName := FreshName(scope, pos, preferredName) + newName := preferredName + if preferredName != "_" { + newName = FreshName(scope, pos, preferredName) + } // Create a new import declaration either before the first existing // declaration (which must exist), including its comments; or @@ -246,6 +259,7 @@ func AddImport(info *types.Info, file *ast.File, preferredName, pkgpath, member if newName != preferredName || newName != pathpkg.Base(pkgpath) { newText = fmt.Sprintf("%s %q", newName, pkgpath) } + decl0 := file.Decls[0] var before ast.Node = decl0 switch decl0 := decl0.(type) { diff --git a/src/cmd/vendor/modules.txt b/src/cmd/vendor/modules.txt index f166b77ea2..133271355f 100644 --- a/src/cmd/vendor/modules.txt +++ b/src/cmd/vendor/modules.txt @@ -73,7 +73,7 @@ golang.org/x/text/internal/tag golang.org/x/text/language golang.org/x/text/transform golang.org/x/text/unicode/norm -# golang.org/x/tools v0.37.1-0.20250915202913-9fccddc465ef +# golang.org/x/tools v0.37.1-0.20250924232827-4df13e317ce4 ## explicit; go 1.24.0 golang.org/x/tools/cmd/bisect golang.org/x/tools/cover