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

Closed
adam-hanna opened this issue Jul 3, 2018 · 14 comments
Closed

cmd/go: case-insensitive import collision with vgo build ./... #26208

adam-hanna opened this issue Jul 3, 2018 · 14 comments
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@adam-hanna
Copy link

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/[email protected]/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/[email protected]/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
Copy link
Contributor

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/[email protected]?

@bcmills bcmills added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jul 4, 2018
@adam-hanna
Copy link
Author

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/[email protected] and then $ vgo build ./...

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

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 Issue is not actionable because of missing required information, which needs to be provided. label Jul 10, 2018
@adam-hanna
Copy link
Author

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 x/vgo: case-insensitive import collision with vgo build ./... cmd/go: case-insensitive import collision with vgo build ./... Jul 12, 2018
@filewalkwithme
Copy link
Contributor

#26238 was merged. Is this issue still happening?

@adam-hanna
Copy link
Author

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

@adam-hanna
Copy link
Author

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 [email protected]:adam-hanna/vgo-bug.git && cd vgo-bug
$ go build .
/home/adam/go/pkg/mod/github.com/docker/[email protected]/broadcast.go:7:2: case-insensitive import collision: "github.com/sirupsen/logrus" and "github.com/Sirupsen/logrus"

@rsc
Copy link
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
Copy link
Author

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

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

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/[email protected]
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 [email protected] but at least the go tooling will work.

@bcmills
Copy link
Contributor

bcmills commented Jan 18, 2019

Would it be possible to consider adding support for:

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

That will likely be allowed once #26904 is addressed. Closing this issue as subsumed by that one.

@bcmills bcmills closed this as completed Jan 18, 2019
brianredbeard added a commit to brianredbeard/fetch-ssh-keys that referenced this issue Jan 9, 2020
In 2018 the GitHub "organization" github.com/Sirupsen changed to all
lower case.  While this was fine in a pre "Go Modules" world, this cases
breaking changes when using modules within Go.

A number of other Go projects have experienced this, for more detail
reference the following:

golang/go#28489
golang/go#26208
@golang golang locked and limited conversation to collaborators Jan 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge 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

8 participants