Skip to content

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

@carnott-snap

Description

@carnott-snap

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"

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions