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

Closed
sagikazarmark opened this issue Feb 25, 2019 · 6 comments
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@sagikazarmark
Copy link

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
Copy link
Contributor

bcmills commented Feb 26, 2019

CC @jayconrod

@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. modules labels Feb 26, 2019
@bcmills bcmills added this to the Go1.13 milestone Feb 26, 2019
@jayconrod jayconrod self-assigned this Feb 26, 2019
@jayconrod
Copy link
Contributor

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.

@jayconrod jayconrod added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Feb 28, 2019
@sagikazarmark
Copy link
Author

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

@bcmills
Copy link
Contributor

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
Copy link
Contributor

bcmills commented Mar 7, 2019

#27063 probably shares the underlying cause.

@gopherbot
Copy link

Change https://golang.org/cl/169720 mentions this issue: cmd/go: clarify error when package is removed in a module

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants