-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
What version of Go are you using (go version
)?
$ go version go version go1.13 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="auto" GOARCH="amd64" GOBIN="/Users/kush.patel/Projects/go/bin" GOCACHE="/Users/kush.patel/Library/Caches/go-build" GOENV="/Users/kush.patel/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GONOPROXY="*.hootops.com" GONOSUMDB="*.hootops.com" GOOS="darwin" GOPATH="/Users/kush.patel/Projects/go" GOPRIVATE="*.hootops.com" GOPROXY="direct" GOROOT="/usr/local/Cellar/go/1.13/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.13/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/kush.patel/Projects/user-info/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/5m/7czshm113rv1wzt8r3cjt_hh0000gp/T/go-build523657452=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
In my go.mod I have for example
module go.hootops.com/hootsuite/user-info
My main func is inside a folder called "cmd/service"
When I run go tool cover -html=.coverage-reports/cover.out -o .coverage-reports/cover.html
from where my go.mod file is (but not inside cmd/service, then I get
cover: cannot run go list: exit status 1
build .: cannot find module for path .
When I run go build .
I get build .: cannot find module for path .
However, go build ./cmd/service
works perfectly fine.
Furthermore, when the project is inside my GOPATH I do not have this error, only when it's outside. With module mode set to auto.
What did you expect to see?
I expected to see build fine and generate coverage report fine, I care more about getting this to work go tool cover -html=.coverage-reports/cover.out -o .coverage-reports/cover.html
since I can build fine doing ./cmd/service.
What did you see instead?
I see the build .: cannot find module for path .
error instead.