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: improve error message when GOMODCACHE does not support file locking #49894

Closed
SeibertronSS opened this issue Dec 1, 2021 · 2 comments
Labels
FrozenDueToAge help wanted modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@SeibertronSS
Copy link

When I open a go project or download some packages, I always get an error, the error message is similar to

go install golang.org/x/tools/cmd/goimports@latest: Lock /export/nfs/xxx/go/pkg/mod/cache/download/golang.org/x/tools/@v/v0.1.7.lock: no locks available

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

$ go version go1.16.10 linux/amd64

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

GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/export/nfs/xxx/.cache/go-build"
GOENV="/export/nfs/xxx/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/export/nfs/xxx/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/export/nfs/xxx/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/export/nfs/xxx/go_env/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/export/nfs/xxx/go_env/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.10"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
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=/tmp/go-build2302821264=/tmp/go-build -gno-record-gcc-switches"

@bcmills bcmills changed the title no locks available cmd/go: "no locks available" when module cache is on NFS Dec 1, 2021
@bcmills bcmills added Unfortunate modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Dec 1, 2021
@bcmills bcmills added this to the Backlog milestone Dec 1, 2021
@bcmills
Copy link
Contributor

bcmills commented Dec 1, 2021

The Go module cache requires a filesystem that supports file-locking. NFS in general does (as of VFS version 4 and Linux 2.6.12), but apparently your /export/nfs mount for some reason does not.

You will need to set either GOMODCACHE or GOPATH to refer to a filesystem that supports file-locking.

(I'm leaving this issue open to improve the diagnostic message, but there really isn't much to do here beyond give a clearer error.)

@bcmills bcmills changed the title cmd/go: "no locks available" when module cache is on NFS cmd/go: improve error message when GOMODCACHE does not support file locking Dec 1, 2021
@SeibertronSS
Copy link
Author

@bcmills Thank you very much!

@golang golang locked and limited conversation to collaborators Dec 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants