]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/modfetch: remove error return from Lookup
authorBryan C. Mills <bcmills@google.com>
Fri, 2 Oct 2020 20:25:17 +0000 (16:25 -0400)
committerBryan C. Mills <bcmills@google.com>
Tue, 13 Oct 2020 20:13:34 +0000 (20:13 +0000)
commitc9211577eb77df9c51f0565f1da7d20ff91d59df
tree8d2790ed1e421a3fd24ef16b1fba14b7569c73f5
parent3a65abfbdac7ab29f693d69bd1eb12b2148a11ae
cmd/go/internal/modfetch: remove error return from Lookup

We generally don't care about errors in resolving a repo if the result
we're looking for is already in the module cache. Moreover, we can
avoid some expense in initializing the repo if all of the methods we
plan to call on it hit in the cache — especially when using
GOPROXY=direct.

This also incidentally fixes a possible (but rare) bug in Download:
we had forgotten to reset the downloaded file in case the Zip method
returned an error after writing a nonzero number of bytes.

For #37438

Change-Id: Ib64f10f763f6d1936536b8e1f7d31ed1b463e955
Reviewed-on: https://go-review.googlesource.com/c/go/+/259158
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/internal/modfetch/cache.go
src/cmd/go/internal/modfetch/coderepo_test.go
src/cmd/go/internal/modfetch/fetch.go
src/cmd/go/internal/modfetch/repo.go
src/cmd/go/internal/modload/mvs.go
src/cmd/go/internal/modload/query.go