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: go test -run '<pattern>' fails with modules #28368

Closed
drewolson opened this issue Oct 24, 2018 · 1 comment
Closed

cmd/go: go test -run '<pattern>' fails with modules #28368

drewolson opened this issue Oct 24, 2018 · 1 comment

Comments

@drewolson
Copy link

drewolson commented Oct 24, 2018

What did you do?

I built a simple example app that has a single blackbox test. I ran the command go test ./..., which succeeded. I then ran the command go test -run 'TestFoo', which failed.

What did you expect to see?

$ go test -run 'TestFoo'
ok      example/foo     0.006s

What did you see instead?

$ go test -run 'TestFoo'
can't load package: package example: unknown import path "example": cannot find module providing package example

System details

go version go1.11.1 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/andolson/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/andolson/go"
GOPROXY=""
GORACE=""
GOROOT="/Users/andolson/.asdf/installs/golang/1.11.1/go"
GOTMPDIR=""
GOTOOLDIR="/Users/andolson/.asdf/installs/golang/1.11.1/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/andolson/code/mod_test/go.mod"
GOROOT/bin/go version: go version go1.11.1 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.11.1
uname -v: Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.13.6
BuildVersion:	17G65
lldb --version: lldb-1000.0.37
  Swift-4.2
@drewolson drewolson changed the title go test -run '<pattern>' fails with modules cmd/go: go test -run '<pattern>' fails with modules Oct 24, 2018
@drewolson
Copy link
Author

drewolson commented Oct 24, 2018

It seems this may be an issue of not providing a path after the pattern. This is what my vim plugin (vim-test) generates for the testing command, but it appears to work if I run go test -run TestFoo ./....

I'll close for now.

@golang golang locked and limited conversation to collaborators Oct 24, 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

2 participants