Skip to content

Commit

Permalink
cmd/go: print a "found" line for each package found instead of each m…
Browse files Browse the repository at this point in the history
…odule added

We currently print a "go: finding" line for each missing package
during import resolution. However, we are only printing a "go: found"
line for each module: if a given module provides multiple packages, we
don't indicate the module that we found for the second and later
packages.

Before this change:

	$ GO111MODULE=on go get golang.org/x/tools/cmd/html2article@78f9822548c13e2c41cc8039d1492a111240db07
	go: found golang.org/x/tools/cmd/html2article in golang.org/x/tools v0.0.0-20190214195451-78f9822548c1
	go: finding module for package golang.org/x/net/html
	go: finding module for package golang.org/x/net/html/atom
	go: downloading golang.org/x/net v0.0.0-20200202094626-16171245cfb2
	go: found golang.org/x/net/html in golang.org/x/net v0.0.0-20200202094626-16171245cfb2

After:

	$ GO111MODULE=on go get golang.org/x/tools/cmd/html2article@78f9822548c13e2c41cc8039d1492a111240db07
	go: found golang.org/x/tools/cmd/html2article in golang.org/x/tools v0.0.0-20190214195451-78f9822548c1
	go: finding module for package golang.org/x/net/html/atom
	go: finding module for package golang.org/x/net/html
	go: found golang.org/x/net/html in golang.org/x/net v0.0.0-20200202094626-16171245cfb2
	go: found golang.org/x/net/html/atom in golang.org/x/net v0.0.0-20200202094626-16171245cfb2

Updates #26152
Updates #33284

Change-Id: I221548749e36bfd6a79efe5edc3645dc5319fd6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/219437
Run-TryBot: Bryan C. Mills <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Jay Conrod <[email protected]>
Reviewed-by: Michael Matloob <[email protected]>
  • Loading branch information
Bryan C. Mills committed Feb 21, 2020
1 parent bcdd5d0 commit 13d73b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cmd/go/internal/modload/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -655,13 +655,13 @@ func (ld *loader) load(roots func() []string) {
if err.newMissingVersion != "" {
base.Fatalf("go: %s: package provided by %s at latest version %s but not at required version %s", pkg.stackText(), err.Module.Path, err.Module.Version, err.newMissingVersion)
}
fmt.Fprintf(os.Stderr, "go: found %s in %s %s\n", pkg.path, err.Module.Path, err.Module.Version)
if added[pkg.path] {
base.Fatalf("go: %s: looping trying to add package", pkg.stackText())
}
added[pkg.path] = true
numAdded++
if !haveMod[err.Module] {
fmt.Fprintf(os.Stderr, "go: found %s in %s %s\n", pkg.path, err.Module.Path, err.Module.Version)
haveMod[err.Module] = true
modAddedBy[err.Module] = pkg
buildList = append(buildList, err.Module)
Expand Down

0 comments on commit 13d73b2

Please sign in to comment.