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

go build fails to fetch the correct go module if multiple processes are trying this at the same time #27623

Closed
schoentoon opened this issue Sep 11, 2018 · 1 comment

Comments

@schoentoon
Copy link

Please answer these questions before submitting your issue. Thanks!

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

go version go1.11 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

GOBIN=""
GOCACHE="/Users/toonschoenmakers/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/toonschoenmakers/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/toonschoenmakers/git/nnd-auth/go.mod"
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/qk/76c0lh7166nbz10bntlqwqw80000gn/T/go-build623752335=/tmp/go-build -gno-record-gcc-switches -fno-common"```

### What did you do?
I decided to run https://github.com/golangci/golangci-lint on one of our internal projects after I had just cleared the go module cache. Due to the concurrent nature of this it ended up fetching the same dependency at the same time

### What did you expect to see?
I expected golangci-lint to just run right away

### What did you see instead?
```go: finding github.com/DATA-DOG/go-sqlmock v1.3.0
go: finding github.com/dwlnetnl/testingx v0.0.0-20160814101815-52306257fefb
go: finding github.com/davecgh/go-spew v1.1.0
go: finding github.com/lib/pq v0.0.0-20180523175426-90697d60dd84
go: finding github.com/go-sql-driver/mysql v1.3.0
go: finding github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165
go: github.com/davecgh/go-spew@v1.1.0: git -c protocol.version=0 fetch --unshallow -f https://github.com/davecgh/go-spew refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /Users/toonschoenmakers/go/pkg/mod/cache/vcs/b9a4b9bbdb4a59723f2348415ad7ffda91568455a1cfd92e97976132bdfbaf57: exit status 128:
	fatal: Unable to create '/Users/toonschoenmakers/go/pkg/mod/cache/vcs/b9a4b9bbdb4a59723f2348415ad7ffda91568455a1cfd92e97976132bdfbaf57/shallow.lock': File exists.

	Another git process seems to be running in this repository, e.g.
	an editor opened by 'git commit'. Please make sure all processes
	are terminated then try again. If it still fails, a git process
	may have crashed in this repository earlier:
	remove the file manually to continue.
go: finding golang.org/x/crypto v0.0.0-20180807104621-f027049dab0a
go: finding code.xsnews.nl/src/rescentral v0.0.0-20180813163958-35e027ef6d35
go: finding code.xsnews.nl/src/endusersdb v0.0.0-20180827162130-93fe7faf5076
go: finding code.xsnews.nl/lib/go-graphite-metrics v0.0.0-20171004120308-d2cfcdaa4842
go: finding code.xsnews.nl/src/sessionsd v0.0.0-20180801112532-630783373dee
go: finding code.xsnews.nl/lib/syslog v0.0.0-20180116170101-fbdbf514309f
go: finding layeh.com/radius v0.0.0-20180814173541-639444c7e76f
go: code.xsnews.nl/src/rescentral@v0.0.0-20180813163958-35e027ef6d35: git -c protocol.version=0 fetch --unshallow -f https://code.xsnews.nl/src/rescentral.git refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /Users/toonschoenmakers/go/pkg/mod/cache/vcs/09f86cabe13c5a65b4c5e7f0cc1d298d8f5e61120fe3ae4aba4a91514754c326: exit status 128:
	fatal: Unable to create '/Users/toonschoenmakers/go/pkg/mod/cache/vcs/09f86cabe13c5a65b4c5e7f0cc1d298d8f5e61120fe3ae4aba4a91514754c326/shallow.lock': File exists.

	Another git process seems to be running in this repository, e.g.
	an editor opened by 'git commit'. Please make sure all processes
	are terminated then try again. If it still fails, a git process
	may have crashed in this repository earlier:
	remove the file manually to continue.
go: code.xsnews.nl/src/endusersdb@v0.0.0-20180827162130-93fe7faf5076: git -c protocol.version=0 fetch --unshallow -f https://code.xsnews.nl/src/endusersdb.git refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /Users/toonschoenmakers/go/pkg/mod/cache/vcs/5308931c869412b1ba95f1a8f2a1a818642be4319aaf99abf374695166aa97e9: exit status 128:
	fatal: shallow file has changed since we read it
go: error loading module requirements```

After some quick looking around through the golang source I ended finding the last error message https://github.com/golang/go/blob/ad644d2e86bab85787879d41c2d2aebbd7c57db8/src/cmd/go/internal/modload/load.go#L996, making me think this is an issue in go rather than golangci-lint. I currently don't have an easy way to reproduce this issue, but I'll try to provide one rather sooner than later.
@mvdan
Copy link
Member

mvdan commented Sep 11, 2018

Duplicate of #26794.

@mvdan mvdan closed this as completed Sep 11, 2018
@golang golang locked and limited conversation to collaborators Sep 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants