diff options
| author | Austin Clements <austin@google.com> | 2020-05-30 20:40:58 +0000 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2020-05-31 00:38:00 +0000 |
| commit | fc40beb987fa503f3452e2e311f765241f5a3cf0 (patch) | |
| tree | 8de925b53589b8e542942a60bddea3dc5f9000b1 | |
| parent | 1ed57c1b720d6ffa8bc8d074aa9a5751a2c81b87 (diff) | |
| download | go-fc40beb987fa503f3452e2e311f765241f5a3cf0.tar.xz | |
Revert "cmd/go: group 'go get' update messages together near the end of output"
This reverts https://golang.org/cl/232578.
Reason for revert: This commit broke TestScript/mod_load_badchain,
which is causing all longtest builders to fail.
Change-Id: I4a17392ce74ac3a7ad340980556025f669d94b65
Reviewed-on: https://go-review.googlesource.com/c/go/+/235857
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
| -rw-r--r-- | src/cmd/go/internal/modget/get.go | 31 | ||||
| -rw-r--r-- | src/cmd/go/testdata/script/mod_get_update_log.txt | 15 |
2 files changed, 3 insertions, 43 deletions
diff --git a/src/cmd/go/internal/modget/get.go b/src/cmd/go/internal/modget/get.go index 0bf9eb3a04..4c6982426f 100644 --- a/src/cmd/go/internal/modget/get.go +++ b/src/cmd/go/internal/modget/get.go @@ -6,10 +6,8 @@ package modget import ( - "bytes" "errors" "fmt" - "io" "os" "path/filepath" "sort" @@ -704,12 +702,6 @@ func runGet(cmd *base.Command, args []string) { modload.AllowWriteGoMod() modload.WriteGoMod() - // Print the changes we made. - // TODO(golang.org/issue/33284): include more information about changes to - // relevant module versions due to MVS upgrades and downgrades. For now, - // the log only contains messages for versions resolved with getQuery. - writeUpdateLog() - // If -d was specified, we're done after the module work. // We've already downloaded modules by loading packages above. // Otherwise, we need to build and install the packages matched by @@ -1042,28 +1034,11 @@ func (r *lostUpgradeReqs) Required(mod module.Version) ([]module.Version, error) return r.Reqs.Required(mod) } -var updateLog struct { - mu sync.Mutex - buf bytes.Buffer - logged map[string]bool -} +var loggedLines sync.Map func logOncef(format string, args ...interface{}) { msg := fmt.Sprintf(format, args...) - updateLog.mu.Lock() - defer updateLog.mu.Unlock() - if updateLog.logged == nil { - updateLog.logged = make(map[string]bool) - } - if updateLog.logged[msg] { - return + if _, dup := loggedLines.LoadOrStore(msg, true); !dup { + fmt.Fprintln(os.Stderr, msg) } - updateLog.logged[msg] = true - fmt.Fprintln(&updateLog.buf, msg) -} - -func writeUpdateLog() { - updateLog.mu.Lock() - defer updateLog.mu.Unlock() - io.Copy(os.Stderr, &updateLog.buf) } diff --git a/src/cmd/go/testdata/script/mod_get_update_log.txt b/src/cmd/go/testdata/script/mod_get_update_log.txt deleted file mode 100644 index 51f138f4eb..0000000000 --- a/src/cmd/go/testdata/script/mod_get_update_log.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Upgrades are reported. -go get -d rsc.io/quote -stderr '^go: rsc.io/quote upgrade => v1.5.2\n\z' - -# Downgrades are not reported. -# TODO(golang.org/issue/33284): they should be. -go get -d rsc.io/quote@v1.5.0 -stderr '^go: downloading.*\n\z' - --- go.mod -- -module m - -go 1.15 - -require rsc.io/quote v1.5.0 |
