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: case-insensitive import collision with vgo build ./... #26208

Open
adam-hanna opened this Issue Jul 3, 2018 · 12 comments

Comments

Projects
None yet
7 participants
@adam-hanna

adam-hanna commented Jul 3, 2018

Please answer these questions before submitting your issue. Thanks!

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

$ go version
go version go1.10.3 linux/amd64

$ vgo version
go version go1.10.3 linux/amd64 vgo:2018-02-20.1

Does this issue reproduce with the latest release?

Have not tried 1.11beta1

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

$ go env
GOARCH="amd64"
GOBIN="/home/adam/go/bin"
GOCACHE="/home/adam/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/adam/go"
GORACE=""
GOROOT="/home/adam/.gvm/gos/go1.10.3"
GOTMPDIR=""
GOTOOLDIR="/home/adam/.gvm/gos/go1.10.3/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build321160569=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ vgo build ./...
...
...
../../../mod/github.com/docker/go-events@v0.0.0-20170721190031-9461782956ad/broadcast.go:7:2: case-insensitive import collision: "github.com/sirupsen/logrus" and "github.com/Sirupsen/logrus"

A simple, demo repo to reproduce can be found, here.

Stackoverflow, here.

I've also tried modifying my go.mod file with

exclude github.com/Sirupsen/logrus v1.0.5

require (
    ...
    github.com/sirupsen/logrus v1.0.5
    ...
)

AND

replace github.com/Sirupsen/logrus v1.0.5 => github.com/sirupsen/logrus v1.0.5

What did you expect to see?

Successful build

What did you see instead?

../../../mod/github.com/docker/go-events@v0.0.0-20170721190031-9461782956ad/broadcast.go:7:2: case-insensitive import collision: "github.com/sirupsen/logrus" and "github.com/Sirupsen/logrus"

@gopherbot gopherbot added this to the vgo milestone Jul 3, 2018

@bcmills

This comment has been minimized.

Member

bcmills commented Jul 4, 2018

vgo tends to choose an old version of docker/docker due to the vgo requirement for semantic import versioning. (The latest docker tags are for v17, but without a versioned import path vgo stops at v1.)

That's probably giving you some transitive dependency that uses a bad import path for logrus.

What happens if you explicitly vgo get github.com/docker/docker@v17.05.0-ce?

@adam-hanna

This comment has been minimized.

adam-hanna commented Jul 5, 2018

Hi @bcmills, thanks for the suggestion, but I got the same error

EDIT - to be clear, I first $ vgo get github.com/docker/docker@v17.05.0-ce and then $ vgo build ./...

@pwaller

This comment has been minimized.

Contributor

pwaller commented Jul 10, 2018

I'm also hitting this in another project @bcmills - one with a very long list of dependencies, including docker and some other large things. It's unclear where the problem comes from, or how to determine it.

I have also reproduced @adam's experience.

@bcmills

This comment has been minimized.

Member

bcmills commented Jul 10, 2018

When we stop automatically picking old versions of things (#26238) it should pretty much go away. Let's revisit once that is fixed.

@bcmills bcmills removed the WaitingForInfo label Jul 10, 2018

@adam-hanna

This comment has been minimized.

adam-hanna commented Jul 10, 2018

Thanks @bcmills! I'll keep an eye on that issue and try again once closed.

@rsc rsc modified the milestones: vgo, Go1.11 Jul 12, 2018

@rsc rsc added the modules label Jul 12, 2018

@rsc rsc changed the title from x/vgo: case-insensitive import collision with vgo build ./... to cmd/go: case-insensitive import collision with vgo build ./... Jul 12, 2018

@filewalkwithme

This comment has been minimized.

Contributor

filewalkwithme commented Aug 1, 2018

#26238 was merged. Is this issue still happening?

@adam-hanna

This comment has been minimized.

adam-hanna commented Aug 1, 2018

@filewalkwithme trying to install from source to check, now. Having some issues but will update you with progress, soon.

@adam-hanna

This comment has been minimized.

adam-hanna commented Aug 1, 2018

@filewalkwithme same problem, unfortunately.

$ go version
go version devel +859a944ee2 Wed Aug 1 21:45:11 2018 +0000 linux/amd64

$ git clone git@github.com:adam-hanna/vgo-bug.git && cd vgo-bug
$ go build .
/home/adam/go/pkg/mod/github.com/docker/go-events@v0.0.0-20170721190031-9461782956ad/broadcast.go:7:2: case-insensitive import collision: "github.com/sirupsen/logrus" and "github.com/Sirupsen/logrus"
@rsc

This comment has been minimized.

Contributor

rsc commented Aug 10, 2018

The root cause here is using such an old version of docker that it pulls in the very old github.com/Sirupsen/logrus, alongside something else that pulls in the newer github.com/sirupsen/logrus. The collision detection is correct, the problem is the bad configuration that causes the collision.

This is not going to change for Go 1.11. We did make the module support better at understanding when a v2.0.0 tag should be considered an incompatible part of the v1 sequence. But docker does not even use valid semver tags, so that didn't help. (v17.05.0-ce is not the "-ce" prerelease of v17.05.0, and more to the point v17.05.0 is not a valid semver version, since the positive numbers can't have leading zeros. It would have to be v17.5.0.)

@rsc rsc modified the milestones: Go1.11, Go1.12 Aug 10, 2018

@adam-hanna

This comment has been minimized.

adam-hanna commented Aug 10, 2018

@rsc Thanks for the help!

Unless I'm mistaken, the example repo is using the most recent release of docker (v17.03.2-ce). The git hash of which is f5ec1e2936dcbe7b5001c2b817188b095c700c27

In go.mod, line #15:

require(
...
github.com/docker/docker v0.0.0-20170601211448-f5ec1e2936dc
...
)

You can see that that is in fact the latest git hash.

EDIT - Scratch the first part of my comment...

Would it be possible to consider adding support for:

replace github.com/Sirupsen/logrus v1.0.5 => github.com/sirupsen/logrus v1.0.5

??

Thanks!

EDIT 2 -
I can confirm that using v17.05.0 works.

@voutasaurus

This comment has been minimized.

voutasaurus commented Aug 22, 2018

It may be worth looking at the corpus to see which major packages vendor an old docker version (pre July 2017). If the responsibility lies with the package maintainers themselves then starting the outreach sooner rather than later will give those package maintainers more time to anticipate the issue.

Also maybe I'm reading this wrong but is there any temporary workaround for those project maintainers who themselves are depending on a package that in turn depends on an old version of docker except for "don't use go mod for dependency management"?

@voutasaurus

This comment has been minimized.

voutasaurus commented Aug 23, 2018

FYI I did this in a repo which depends on github.com/hyperledger/fabric which depends on an old version of docker as a workaround and the error went away:

go mod init
go get github.com/docker/docker@v0.0.0-20180422163414-57142e89befe
go test ./...

No manual editing of go.mod required. Tested in fresh golang:rc container.

I'm not sure if github.com/hyperledger/fabric will actually work with docker@v0.0.0-20180422163414-57142e89befe but at least the go tooling will work.

birdayz added a commit to birdayz/conjungo that referenced this issue Nov 27, 2018

birdayz added a commit to birdayz/conjungo that referenced this issue Nov 27, 2018

@br-lewis br-lewis referenced this issue Nov 30, 2018

Open

Switch from dep to `go mod` #64

4 of 4 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment