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: 'go mod vendor' does not fail on case-insensitive import collision #38571

Open
carnott-snap opened this issue Apr 21, 2020 · 5 comments · May be fixed by #38814
Open

cmd/go: 'go mod vendor' does not fail on case-insensitive import collision #38571

carnott-snap opened this issue Apr 21, 2020 · 5 comments · May be fixed by #38814

Comments

@carnott-snap
Copy link

@carnott-snap carnott-snap commented Apr 21, 2020

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

$ go version
go version go1.14.2 linux/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

During the investigation of #38342, I discovered the following ux quirk:

On a case insensitive filesystem: (I am using vfat)

package main

import (
	_ "example.com/Foo"
	_ "example.com/foo"
)

func main() {}
-- go.mod --
module play.ground

go 1.14

require (
	example.com/foo v0.1.0
	example.com/Foo v0.1.0
)

replace (
	example.com/foo => ./foo
	example.com/Foo => ./!foo
)
-- foo/go.mod --
module example.com/foo
-- foo/foo.go --
package foo
-- !foo/go.mod --
module example.com/Foo
-- !foo/foo.go --
package Foo
go mod vendor

What did you expect to see?

main.go:5:2: case-insensitive import collision: "example.com/foo" and "example.com/FOO"

What did you see instead?

go mod vendor succeeds, but go build fails, and one must flush vendor to fix things:

go build
main.go:5:2: case-insensitive import collision: "example.com/foo" and "example.com/FOO"
@jayconrod jayconrod added this to the Backlog milestone Apr 21, 2020
@justplesh
Copy link
Contributor

@justplesh justplesh commented Apr 30, 2020

I will work on this

justplesh added a commit to justplesh/go that referenced this issue May 2, 2020
The existing implementation of go mod vendor allows having
case-insensitive imports, which will anyway fail during go build.
This improvement validates such collisions during any mod pkg
loads ('tidy', 'why', 'vendor').

Fixes golang#38571
justplesh added a commit to justplesh/go that referenced this issue May 2, 2020
The existing implementation of go mod vendor allows having
case-insensitive imports, which will anyway fail during go build.
This improvement validates such collisions during any mod pkg
loads ('tidy', 'why', 'vendor').

Fixes golang#38571
@gopherbot
Copy link

@gopherbot gopherbot commented May 2, 2020

Change https://golang.org/cl/231679 mentions this issue: cmd: fail go mod vendor on case-insensitive import collisions

@justplesh
Copy link
Contributor

@justplesh justplesh commented Jun 4, 2020

@jayconrod any chance to get a review? 😟

@jayconrod
Copy link
Contributor

@jayconrod jayconrod commented Jun 4, 2020

@justplesh I think @bcmills would be a better reviewer for this. I haven't read through the full discussion in #38342 or thought about all the implications.

@justplesh
Copy link
Contributor

@justplesh justplesh commented Jun 4, 2020

@bcmills would appreciate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.