mirror of
https://github.com/golang/go
synced 2024-09-30 09:38:38 -06:00
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>
This commit is contained in:
parent
1ed57c1b72
commit
fc40beb987
@ -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 _, dup := loggedLines.LoadOrStore(msg, true); !dup {
|
||||
fmt.Fprintln(os.Stderr, msg)
|
||||
}
|
||||
if updateLog.logged[msg] {
|
||||
return
|
||||
}
|
||||
updateLog.logged[msg] = true
|
||||
fmt.Fprintln(&updateLog.buf, msg)
|
||||
}
|
||||
|
||||
func writeUpdateLog() {
|
||||
updateLog.mu.Lock()
|
||||
defer updateLog.mu.Unlock()
|
||||
io.Copy(os.Stderr, &updateLog.buf)
|
||||
}
|
||||
|
@ -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
|
Loading…
Reference in New Issue
Block a user