aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modload/build.go
diff options
context:
space:
mode:
authorAndrew Bonventre <andybons@google.com>2020-02-24 22:47:00 +0000
committerAndrew Bonventre <andybons@golang.org>2020-02-24 23:29:37 +0000
commit917c7a6fc9c6843e40da7f8e1a1fcf8605d1383e (patch)
tree0dbc8327321f94580f7e5ccc9c40c8a874caa9c6 /src/cmd/go/internal/modload/build.go
parent2bfa8c37c3676d240ce947d58717fc8c0caa45f1 (diff)
downloadgo-917c7a6fc9c6843e40da7f8e1a1fcf8605d1383e.tar.gz
go-917c7a6fc9c6843e40da7f8e1a1fcf8605d1383e.zip
Revert "cmd/go/internal/modload: record the replacement for the module containing package main in BuildInfo"
This reverts CL 220645 (commit e092fc352ad393a4d2f1f7fa641df2d23572ccff). Reason for revert: Seems to have broken windows/amd64 longtest Change-Id: Iffa8c882524250e5845514bc827fcd8927645a44 Reviewed-on: https://go-review.googlesource.com/c/go/+/220722 Run-TryBot: Andrew Bonventre <andybons@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/go/internal/modload/build.go')
-rw-r--r--src/cmd/go/internal/modload/build.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/cmd/go/internal/modload/build.go b/src/cmd/go/internal/modload/build.go
index 454dbf28cf..6fa47d7400 100644
--- a/src/cmd/go/internal/modload/build.go
+++ b/src/cmd/go/internal/modload/build.go
@@ -207,7 +207,6 @@ func PackageBuildInfo(path string, deps []string) string {
if isStandardImportPath(path) || !Enabled() {
return ""
}
-
target := mustFindModule(path, path)
mdeps := make(map[module.Version]bool)
for _, dep := range deps {
@@ -224,25 +223,26 @@ func PackageBuildInfo(path string, deps []string) string {
var buf bytes.Buffer
fmt.Fprintf(&buf, "path\t%s\n", path)
-
- writeEntry := func(token string, m module.Version) {
- mv := m.Version
+ tv := target.Version
+ if tv == "" {
+ tv = "(devel)"
+ }
+ fmt.Fprintf(&buf, "mod\t%s\t%s\t%s\n", target.Path, tv, modfetch.Sum(target))
+ for _, mod := range mods {
+ mv := mod.Version
if mv == "" {
mv = "(devel)"
}
- fmt.Fprintf(&buf, "%s\t%s\t%s", token, m.Path, mv)
- if r := Replacement(m); r.Path == "" {
- fmt.Fprintf(&buf, "\t%s\n", modfetch.Sum(m))
- } else {
- fmt.Fprintf(&buf, "\n=>\t%s\t%s\t%s\n", r.Path, r.Version, modfetch.Sum(r))
+ r := Replacement(mod)
+ h := ""
+ if r.Path == "" {
+ h = "\t" + modfetch.Sum(mod)
+ }
+ fmt.Fprintf(&buf, "dep\t%s\t%s%s\n", mod.Path, mv, h)
+ if r.Path != "" {
+ fmt.Fprintf(&buf, "=>\t%s\t%s\t%s\n", r.Path, r.Version, modfetch.Sum(r))
}
}
-
- writeEntry("mod", target)
- for _, mod := range mods {
- writeEntry("dep", mod)
- }
-
return buf.String()
}