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: 'looping trying to add package' when running 'mod tidy' with a package not found in the containing module #30394

Open
sagikazarmark opened this Issue Feb 25, 2019 · 5 comments

Comments

Projects
None yet
3 participants
@sagikazarmark
Copy link

sagikazarmark commented Feb 25, 2019

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

$ go version
go version go1.11.5 darwin/amd64

Does this issue reproduce with the latest release?

Yes, it does (at the time of writing 1.11.5 is the latest).

Note: reproduced the issue with go1.12rc1 as well

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/mark/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/mark/.go:/Users/mark/Projects/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/mark/Projects/go/src/github.com/banzaicloud/pipeline/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/vy/hzm88gt90292ztr9f3qg9zhr0000gn/T/go-build985692952=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

git clone git@github.com:banzaicloud/pipeline.git
export GO111MODULE=on
git checkout ce96c5fd39bbb2558a4dff50258cc9634a9749ac
go mod init
go mod edit -replace=github.com/qor/auth@master=github.com/banzaicloud/auth@master`
go mod tidy

What did you expect to see?

Go command should have exited with tidied modules.

What did you see instead?

go: import "github.com/banzaicloud/pipeline/cluster" ->
	import "github.com/gin-gonic/gin/json": looping trying to add package

@bcmills bcmills changed the title go/modules: looping trying to add package cmd/go: looping trying to add package Feb 26, 2019

@bcmills

This comment has been minimized.

Copy link
Member

bcmills commented Feb 26, 2019

@bcmills bcmills added this to the Go1.13 milestone Feb 26, 2019

@jayconrod jayconrod self-assigned this Feb 26, 2019

@jayconrod

This comment has been minimized.

Copy link
Contributor

jayconrod commented Feb 28, 2019

This error is happening because the package github.com/gin-gonic/gin/json was removed in newer versions of the module github.com/gin-gonic/gin (actually renamed to internal/json, but removed as far as everyone else is concerned). The "looping" error message comes up when we can't import the same package after more than one round of module loading.

So this is kind of working as intended (deleting a package is a breaking change), but we should report a more helpful error message.

You can work around this by removing imports of github.com/gin-gonic/gin/json in your project. If you still need it, you'll need to make a local copy of it.

@sagikazarmark

This comment has been minimized.

Copy link
Author

sagikazarmark commented Feb 28, 2019

Thanks! I actually did that and removed the import, so from my end the problem is resolved.

@bcmills

This comment has been minimized.

Copy link
Member

bcmills commented Mar 7, 2019

Related: #29121 and #27102

@bcmills bcmills changed the title cmd/go: looping trying to add package cmd/go: 'looping trying to add package' when running 'mod tidy' with a package not found in the containing module Mar 7, 2019

@bcmills

This comment has been minimized.

Copy link
Member

bcmills commented Mar 7, 2019

#27063 probably shares the underlying cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.