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: fails to find *_test package when testing #26807

Closed
hajimehoshi opened this issue Aug 4, 2018 · 6 comments
Closed

cmd/go: fails to find *_test package when testing #26807

hajimehoshi opened this issue Aug 4, 2018 · 6 comments

Comments

@hajimehoshi
Copy link
Member

hajimehoshi commented Aug 4, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.11beta3 darwin/amd64

Does this issue reproduce with the latest release?

Yes (Go 1.11 Beta 3)

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/hajimehoshi/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/hajimehoshi/go"
GOPROXY=""
GORACE=""
GOROOT="/Users/hajimehoshi/sdk/go1.11beta3"
GOTMPDIR=""
GOTOOLDIR="/Users/hajimehoshi/sdk/go1.11beta3/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/hajimehoshi/mygo/go.mod"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/b7/w11sqqrx7kx6fqfbn24wdsmh0000gn/T/go-build531286046=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

mkdir mygo
cd mygo
go1.11beta3 mod init example.com/m
GO111MODULE=on go1.11beta3 test github.com/hajimehoshi/ebiten

Note that Ebiten package has two package names: ebiten and ebiten_test.

What did you expect to see?

Test succeeds.

What did you see instead?

Test fails with an error message:

build github.com/hajimehoshi/ebiten_test: cannot find module for path github.com/hajimehoshi/ebiten_test
@hajimehoshi
Copy link
Member Author

Note that this is a regression: Go 1.11 beta 2 worked well with this case.

@thepudds
Copy link
Contributor

thepudds commented Aug 4, 2018

@gopherbot, please add label modules

@mpx
Copy link
Contributor

mpx commented Aug 5, 2018

Here is a trivial example to reproduce:

go mod init foo
cat > a_test.go <<EOT
package foo_test
import "testing"
func TestA(t *testing.T) {}
EOT
mkdir a
cp a_test.go a

go1.11beta2 tests fine in both directories, but go1.11beta3 now fails in the module root with an external test package:

$ ~/go1.11beta2/bin/go test foo foo/a
ok      foo     0.001s
ok      foo/a   0.001s
$ ~/go1.11beta3/bin/go test foo
build foo_test: cannot find module for path foo_test
$ ~/go1.11beta3/bin/go test foo/a
ok      foo/a   0.001s

@mpx
Copy link
Contributor

mpx commented Aug 5, 2018

Bisect shows it breaks at b294fe9 which was submitted to fix #23970

@bcmills

@mpx
Copy link
Contributor

mpx commented Aug 5, 2018

Looks like this is the same bug as #26722

@bcmills
Copy link
Contributor

bcmills commented Aug 5, 2018

Closing as duplicate.

@bcmills bcmills closed this as completed Aug 5, 2018
@golang golang locked and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants