aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modfetch/fetch.go
diff options
context:
space:
mode:
authorJay Conrod <jayconrod@google.com>2020-06-29 16:28:18 -0400
committerJay Conrod <jayconrod@google.com>2020-08-14 21:04:00 +0000
commit016e13df7475329c65524b2eabbc5207ceb4ee74 (patch)
treec1ebd5af23706bab8d6bf1515fff9123f11432f5 /src/cmd/go/internal/modfetch/fetch.go
parent5ae198087bd07e88009885ac96c864381f8d8272 (diff)
downloadgo-016e13df7475329c65524b2eabbc5207ceb4ee74.tar.gz
go-016e13df7475329c65524b2eabbc5207ceb4ee74.zip
cmd/go/internal/modfetch: stop migrating go.modverify to go.sum
go.modverify was renamed to go.sum before vgo was merged into cmd/go. It's been long enough that we can safely drop support for it. For #25525 Change-Id: If8da66280a0fb6a4d4db0b170700775523c18571 Reviewed-on: https://go-review.googlesource.com/c/go/+/240458 Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/modfetch/fetch.go')
-rw-r--r--src/cmd/go/internal/modfetch/fetch.go31
1 files changed, 4 insertions, 27 deletions
diff --git a/src/cmd/go/internal/modfetch/fetch.go b/src/cmd/go/internal/modfetch/fetch.go
index fd7a5cef83..8df2289097 100644
--- a/src/cmd/go/internal/modfetch/fetch.go
+++ b/src/cmd/go/internal/modfetch/fetch.go
@@ -374,12 +374,11 @@ type modSum struct {
var goSum struct {
mu sync.Mutex
- m map[module.Version][]string // content of go.sum file (+ go.modverify if present)
+ m map[module.Version][]string // content of go.sum file
checked map[modSum]bool // sums actually checked during execution
dirty bool // whether we added any new sums to m
overwrite bool // if true, overwrite go.sum without incorporating its contents
enabled bool // whether to use go.sum at all
- modverify string // path to go.modverify, to be deleted
}
// initGoSum initializes the go.sum data.
@@ -403,19 +402,6 @@ func initGoSum() (bool, error) {
goSum.enabled = true
readGoSum(goSum.m, GoSumFile, data)
- // Add old go.modverify file.
- // We'll delete go.modverify in WriteGoSum.
- alt := strings.TrimSuffix(GoSumFile, ".sum") + ".modverify"
- if data, err := renameio.ReadFile(alt); err == nil {
- migrate := make(map[module.Version][]string)
- readGoSum(migrate, alt, data)
- for mod, sums := range migrate {
- for _, sum := range sums {
- addModSumLocked(mod, sum)
- }
- }
- goSum.modverify = alt
- }
return true, nil
}
@@ -616,14 +602,9 @@ func WriteGoSum() {
goSum.mu.Lock()
defer goSum.mu.Unlock()
- if !goSum.enabled {
- // If we haven't read the go.sum file yet, don't bother writing it: at best,
- // we could rename the go.modverify file if it isn't empty, but we haven't
- // needed to touch it so far — how important could it be?
- return
- }
- if !goSum.dirty {
- // Don't bother opening the go.sum file if we don't have anything to add.
+ if !goSum.enabled || !goSum.dirty {
+ // If we haven't read go.sum yet or if we don't have anything to add,
+ // don't bother opening it.
return
}
if cfg.BuildMod == "readonly" {
@@ -674,10 +655,6 @@ func WriteGoSum() {
goSum.checked = make(map[modSum]bool)
goSum.dirty = false
goSum.overwrite = false
-
- if goSum.modverify != "" {
- os.Remove(goSum.modverify) // best effort
- }
}
// TrimGoSum trims go.sum to contain only the modules for which keep[m] is true.