Closed
Description
What version of Go are you using (go version
)?
go version devel +ecec63c8a1 Tue Jul 31 16:34:38 2018 +0000 darwin/amd64
Does this issue reproduce with the latest release?
testing with tip (issue does not reproduce in go1.11beta2)
What operating system and processor architecture are you using (go env
)?
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/suzmue/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/suzmue/go"
GOPROXY=""
GORACE=""
GOROOT="/Users/suzmue/tipgo/go"
GOTMPDIR=""
GOTOOLDIR="/Users/suzmue/tipgo/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/suzmue/myproject/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/c4/982kvfgd4jz6_6sdlzzk2nj400fkl_/T/go-build226914824=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
Files in directory a:
a/a.go:
package a
a/a_test.go:
package a; import "testing"; func Test(t *testing.T){}
a/go.mod:
module github.com/user/a
$ cd a/
$ go test
What did you expect to see?
PASS
ok github.com/user/a 0.017s
What did you see instead?
build github.com/user/a (test): cannot find module for path github.com/user/a (test)
Additional notes
go test
works as expected in any subdirectories of a.