Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: treat most errors as fatal when resolving a package with a proxy #31730

Open
jayconrod opened this issue Apr 28, 2019 · 0 comments

Comments

@jayconrod
Copy link
Contributor

commented Apr 28, 2019

What version of Go are you using (go version)?

go1.12.4 and master (049c8dbf)

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/jayconrod/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/jayconrod/go"
GOPROXY="http://127.0.0.1:6123/mod"
GORACE=""
GOROOT="/opt/go/installed"
GOTMPDIR=""
GOTOOLDIR="/opt/go/installed/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/rq/x0692kqj6ml8cvrhcqh5bswc008xj1/T/go-build212227611=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

In src/cmd/go/testdata/script/mod_load_badzip.txt, remove commands except the go build command, so that go build runs with an empty module.

! go build rsc.io/badzip

What did you expect to see?

The zip file for this module contains a superfluous .info file. We should see an error about that.

What did you see instead?

Instead, we see a message cannot find module providing package.

Analysis

When we want to load a package that isn't provided by any module in the build list, we attempt to retrieve modules that could provide the package. In this case, we'll look for rsc.io and rsc.io/badzip. Frequently, these modules don't exist (we get a 404 or 410 from the proxy), so if there's an error on every path we try, we report cannot find module providing package.

Many other errors are possible though. We should distinguish "not found" errors from "found but couldn't access" errors.

When we fetch code from a VCS, we have a special codehost.VCSError type which covers "found but couldn't access" errors. Instead, we should define a special "not found" error type in cmd/go/internal/modfetch (used with both proxy and VCS), and we should treat all other errors as "found but couldn't access".

@jayconrod jayconrod added this to the Go1.13 milestone Apr 28, 2019

@jayconrod jayconrod self-assigned this Apr 28, 2019

@andybons andybons modified the milestones: Go1.13, Go1.14 Jul 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.