]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/modfetch/codehost: treat nonexistent repositories as “not found”
authorBryan C. Mills <bcmills@google.com>
Thu, 5 Sep 2019 18:27:27 +0000 (14:27 -0400)
committerBryan C. Mills <bcmills@google.com>
Wed, 11 Sep 2019 14:02:43 +0000 (14:02 +0000)
commitf6c691e0e1b1434a02301c39e6d66e21699a98a8
treee77778051b70021504b03bf5bfa574bbb5d7a78f
parent0e015e20cfe7265635af605d274ff8dc2de5b3a2
cmd/go/internal/modfetch/codehost: treat nonexistent repositories as “not found”

If a go-import directive refers to a nonexistent repository, today we
treat that as an error fetching a module that actually exists.
That makes the HTTP server responsible for determining which
repositories do or do not exist, which may in general depend on
the user's separately-stored credentials, and imposes significant
complexity on such a server, which can otherwise be very simple.

Instead, check the repository URL and/or error message to try to
determine whether the repository exists at all. If the repo does not
exist, treat its absence as a “not found” error — as if the server had
not returned it in the first place.

Updates #34094

Change-Id: I142619ff43b96d0de428cdd0b01cca828c9ba234
Reviewed-on: https://go-review.googlesource.com/c/go/+/194561
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/internal/modfetch/codehost/git.go
src/cmd/go/internal/modfetch/proxy.go
src/cmd/go/testdata/script/mod_missing_repo.txt [new file with mode: 0644]