mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/go: fix get -tool when multiple packages are provided
Fixes #74035 Change-Id: I51865f4f753aade9a8be62ed6f9bc2d298742bf1 Reviewed-on: https://go-review.googlesource.com/c/go/+/679975 Reviewed-by: Ian Alexander <jitsu@google.com> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Michael Matloob <matloob@golang.org> Auto-Submit: Sean Liao <sean@liao.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sean Liao <sean@liao.dev>
This commit is contained in:
parent
c7b85e9ddc
commit
dcc77f9e3c
2 changed files with 26 additions and 1 deletions
|
|
@ -453,7 +453,7 @@ func updateTools(ctx context.Context, queries []*query, opts *modload.WriteOpts)
|
|||
if queries[i].version == "none" {
|
||||
opts.DropTools = append(opts.DropTools, m.Pkgs...)
|
||||
} else {
|
||||
opts.AddTools = append(opts.DropTools, m.Pkgs...)
|
||||
opts.AddTools = append(opts.AddTools, m.Pkgs...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
25
src/cmd/go/testdata/script/mod_get_tool_issue74035.txt
vendored
Normal file
25
src/cmd/go/testdata/script/mod_get_tool_issue74035.txt
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Regression test for https://go.dev/issue/74035.
|
||||
go get -tool example.com/foo/cmd/a example.com/foo/cmd/b
|
||||
cmp go.mod go.mod.want
|
||||
|
||||
-- go.mod --
|
||||
module example.com/foo
|
||||
go 1.24
|
||||
-- go.mod.want --
|
||||
module example.com/foo
|
||||
|
||||
go 1.24
|
||||
|
||||
tool (
|
||||
example.com/foo/cmd/a
|
||||
example.com/foo/cmd/b
|
||||
)
|
||||
-- cmd/a/a.go --
|
||||
package a
|
||||
|
||||
func main() {}
|
||||
|
||||
-- cmd/b/b.go --
|
||||
package b
|
||||
|
||||
func main() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue