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

Comments

Projects
None yet
5 participants
@hajimehoshi
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor Author

commented Aug 4, 2018

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

@thepudds

This comment has been minimized.

Copy link

commented Aug 4, 2018

@gopherbot, please add label modules

@gopherbot gopherbot added the modules label Aug 4, 2018

@mpx

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

commented Aug 5, 2018

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

@bcmills

@mpx

This comment has been minimized.

Copy link
Contributor

commented Aug 5, 2018

Looks like this is the same bug as #26722

@bcmills

This comment has been minimized.

Copy link
Member

commented Aug 5, 2018

Closing as duplicate.

@bcmills bcmills closed this Aug 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.