]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/go/internal/modfetch: prevent duplicate hashes in go.sum
authorJosh Powers <jpowers@influxdata.com>
Fri, 17 Jun 2022 18:22:12 +0000 (18:22 +0000)
committerGopher Robot <gobot@golang.org>
Fri, 17 Jun 2022 21:38:40 +0000 (21:38 +0000)
commit103cc661f1906837d02133e9c65d0475ac49799c
treed4e80042e01086a8fd0393bb5b184b0ecbc06b31
parentd42a48828f3cff4e57cefaf72bc88cef7d355fd6
cmd/go/internal/modfetch: prevent duplicate hashes in go.sum

To write go.sum, each module and then each hash is looped through. The
hashes are kept in a slice and there is no check to ensure that hashes
were not added or already exist in the file. Therefore, unique the
hashes of each module before writing to prevent duplicates.

Fixes: #28456
Change-Id: I1cf7e7cdee3e7530a0ee605cd76d738627be1e0d
GitHub-Last-Rev: 0ed02e9591e966fe5f6ba275635c3974daa2656e
GitHub-Pull-Request: golang/go#53291
Reviewed-on: https://go-review.googlesource.com/c/go/+/411154
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/go/internal/modfetch/fetch.go
src/cmd/go/testdata/script/mod_tidy_duplicates.txt [new file with mode: 0644]