go: cmd/go: loading dependencies with `go test -i` does not correctly handle `*.go` import paths

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

$ go version
go version go1.13.1 darwin/amd64

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN="/Users/USERNAME/go/bin"
GOCACHE="/Users/USERNAME/Library/Caches/go-build"
GOENV="/Users/USERNAME/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/USERNAME>/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/USERNAME/go/src/github.com/resgateio/resgate/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/1y/y8rl2vbs3jzc3y9lsfms_5qm0000gn/T/go-build160952166=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Running go test -i to prefetch dependencies for tests.

What did you expect to see?

The command ending with a 0 exit-code.

What did you see instead?

An error message:

can't load package: named files must be .go files: bytes

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (13 by maintainers)

Commits related to this issue

Most upvoted comments

It does not appear that the test you added was wrong @Skarlso. This issue involves an edge-case that does not yet appear to be covered by tests. I am writing new tests right now to get a reproduction after which I can start looking at writing the actual fix.

I was able to to trigger the error as well through go list. Simply supply mixed patterns:

$ go list ./server/... ./nats/nats.go
can't load package: named files must be .go files: ./server/...

$ go list ./server/...
github.com/resgateio/resgate/server
github.com/resgateio/resgate/server/codec
github.com/resgateio/resgate/server/mq
github.com/resgateio/resgate/server/rescache
github.com/resgateio/resgate/server/reserr
github.com/resgateio/resgate/server/rpc

$ go list ./nats/nats.go
command-line-arguments