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: unable to run test cases when package name of foo_test.go is foo_test for package foo #27086

Closed
mewmew opened this issue Aug 19, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@mewmew
Copy link
Contributor

commented Aug 19, 2018

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

vgo version
go version go1.10.3 linux/amd64 vgo:devel +1b870077c8

Does this issue reproduce with the latest release?

Yes.

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

$ vgo env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/u/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/u/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/tmp/flac/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=/tmp/go-build710970470=/tmp/go-build -gno-record-gcc-switches"

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

Using vgo to run test cases does not work (fails with cannot find module flac_test error), while equivalent commands for go works with go-get.

$ unset GOPATH
$ git clone https://github.com/mewkiz/flac.git
$ cd flac
$ vgo install ./...
$ vgo test ./...
build github.com/mewkiz/flac_test: cannot find module for path github.com/mewkiz/flac_test

What did you expect to see?

Test cases being run.

For comparison, an equivalent set of commands that fail for vgo test work with go test:

u@x61s ~> /bin/bash
[u@x61s ~]$ go version
go version go1.10.3 linux/amd64
[u@x61s ~]$ export GOPATH=/tmp/go
[u@x61s ~]$ go get github.com/mewkiz/flac/...
[u@x61s ~]$ go test github.com/mewkiz/flac/...
ok  	github.com/mewkiz/flac	0.022s
?   	github.com/mewkiz/flac/cmd/flac2wav	[no test files]
?   	github.com/mewkiz/flac/cmd/go-metaflac	[no test files]
?   	github.com/mewkiz/flac/cmd/wav2flac	[no test files]
ok  	github.com/mewkiz/flac/frame	2.666s
ok  	github.com/mewkiz/flac/internal/bits	0.016s
?   	github.com/mewkiz/flac/internal/hashutil	[no test files]
ok  	github.com/mewkiz/flac/internal/hashutil/crc16	0.004s
ok  	github.com/mewkiz/flac/internal/hashutil/crc8	0.003s
?   	github.com/mewkiz/flac/internal/ioutilx	[no test files]
?   	github.com/mewkiz/flac/internal/utf8	[no test files]
ok  	github.com/mewkiz/flac/meta	0.004s

What did you see instead?

The error message:

build github.com/mewkiz/flac_test: cannot find module for path github.com/mewkiz/flac_test
@agnivade

This comment has been minimized.

Copy link
Member

commented Aug 20, 2018

Kindly try with the 1.11rc1 build. vgo is now merged with the main tree.

@mewmew

This comment has been minimized.

Copy link
Contributor Author

commented Aug 20, 2018

@agnivade Thanks. I pulled the latest version of Go, and it seems to work just fine.

$ unset GOPATH
$ go version
go version devel +dc79206aec Mon Aug 20 05:23:29 2018 +0000 linux/amd64
$ go test -count=1 ./...
ok  	github.com/mewkiz/flac	0.060s
?   	github.com/mewkiz/flac/cmd/flac2wav	[no test files]
?   	github.com/mewkiz/flac/cmd/go-metaflac	[no test files]
?   	github.com/mewkiz/flac/cmd/wav2flac	[no test files]
ok  	github.com/mewkiz/flac/frame	7.006s
ok  	github.com/mewkiz/flac/internal/bits	0.008s
?   	github.com/mewkiz/flac/internal/hashutil	[no test files]
ok  	github.com/mewkiz/flac/internal/hashutil/crc16	0.012s
ok  	github.com/mewkiz/flac/internal/hashutil/crc8	0.011s
?   	github.com/mewkiz/flac/internal/ioutilx	[no test files]
?   	github.com/mewkiz/flac/internal/utf8	[no test files]
ok  	github.com/mewkiz/flac/meta	0.036s

@mewmew mewmew closed this Aug 20, 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.