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>
diff --git a/src/cmd/go/internal/modget/get.go b/src/cmd/go/internal/modget/get.go
index 0bf9eb3..4c69824 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 @@
 	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 @@
 	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)
 }
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 51f138f..0000000
--- 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