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: repeated, unhelpful errors when module cache can't be created #45113

Open
jayconrod opened this issue Mar 18, 2021 · 1 comment
Open

cmd/go: repeated, unhelpful errors when module cache can't be created #45113

jayconrod opened this issue Mar 18, 2021 · 1 comment
Milestone

Comments

@jayconrod
Copy link
Contributor

@jayconrod jayconrod commented Mar 18, 2021

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

$ go version
go1.16.2

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
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/jayconrod/Library/Caches/go-build"
GOENV="/Users/jayconrod/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/does/not/exist/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/does/not/exist"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/go/installed"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/go/installed/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.2"
GCCGO="gccgo"
AR="ar"
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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/rq/x0692kqj6ml8cvrhcqh5bswc008xj1/T/go-build3704992266=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Set environment variables such that the module cache directory can't be created as a directory. In this example below, I've explicitly set GOMODCACHE to a path I don't have access to.

export GOMODCACHE=/does/not/exist
go install golang.org/x/tools/gopls@latest

This came up in this golang-nuts thread. In that example, neither GOPATH nor GOMODCACHE was set, so GOMODCACHE defaulted to $HOME/go/pkg/mod, but $HOME/go is not a directory.

What did you expect to see?

An error message that explains what the problem is and how to fix it, printed once.

What did you see instead?

An unhelpful message, printed multiple times.

$ go install golang.org/x/tools/gopls@latest
go: writing stat cache: mkdir /does: read-only file system
go: writing stat cache: mkdir /does: read-only file system
go: writing go.mod cache: mkdir /does: read-only file system
go: downloading golang.org/x/tools/gopls v0.6.8
go: writing go.mod cache: mkdir /does: read-only file system
go: downloading golang.org/x/tools v0.1.0
go install golang.org/x/tools/gopls@latest: mkdir /does: read-only file system
@jayconrod jayconrod added the NeedsFix label Mar 18, 2021
@jayconrod jayconrod added this to the Go1.17 milestone Mar 18, 2021
@oiooj oiooj added the GoCommand label Mar 19, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Mar 24, 2021

Change https://golang.org/cl/304571 mentions this issue: cmd/go: display helpful error when module cache can't be created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants