golang/go

cmd/go: import paths can contain the `.test` suffix, breaking the toolchain

Open

#60,454 opened on May 26, 2023

View on GitHub
 (6 comments) (1 reaction) (0 assignees)Go (19,008 forks)batch import
GoCommandNeedsInvestigationhelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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

Does this issue reproduce with the latest release?

Yes

What did you do?

Given

-- foo/foo.go --
package foo

import _ "example.com/foo.test"
-- foo/foo_test.go --
package foo
-- foo.test/bar.go --
package bar
-- go.mod --
module example.com

go 1.21

run go test ./foo

What did you expect to see?

One of

  • no error
  • an explanation for the error
  • an explicit error forbidding using foo.test as an import path

What did you see instead?

/home/dominikh/prj/go/pkg/tool/linux_amd64/link: fingerprint mismatch: example.com/foo.test has 36b962da8ceb542c, import from example.com/foo expecting aa419b4c2ff8e5ed

Contributor guide