Ask questionscmd/go: needs a better error than "missing dot in first path element" when GOROOT is set incorrectly
what's wrong about the error
build command-line-arguments: cannot load golang_org/x/crypto/chacha20poly1305: malformed module path "golang_org/x/crypto/chacha20poly1305": missing dot in first path element

Answer
questions
katcipis
Im getting a similar behaviour, the code is not open source and I haven't isolated the problem yet, but the same code that was working 5 minutes ago with Go 1.12.9 now gives this error with 1.13. Running go mod vendor results in:
github.com/prv/store imports
cloud.google.com/go/datastore imports
google.golang.org/api/option imports
golang.org/x/oauth2/google imports
golang.org/x/oauth2/jws imports
crypto: malformed module path "crypto": missing dot in first path element
github.com/prv/store imports
cloud.google.com/go/datastore imports
google.golang.org/api/option imports
golang.org/x/oauth2/google imports
golang.org/x/oauth2/jws imports
crypto/sha256: malformed module path "crypto/sha256": missing dot in first path element
github.com/prv/store imports
cloud.google.com/go/datastore imports
google.golang.org/api/transport/grpc imports
go.opencensus.io/plugin/ocgrpc imports
go.opencensus.io/tag imports
runtime/pprof: malformed module path "runtime/pprof": missing dot in first path element
github.com/prv/store imports
cloud.google.com/go/datastore imports
google.golang.org/grpc imports
golang.org/x/net/http2 imports
golang.org/x/net/idna imports
golang.org/x/text/unicode/bidi imports
container/list: malformed module path "container/list": missing dot in first path element
go test ./... and go get ./...:
build github.com/prv/cmd/prv: cannot load bufio: malformed module path "bufio": missing dot in first path element
OS:
uname -a
Darwin macbook 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64
Go:
go version
go version go1.13 darwin/amd64
Got suspicious of a recent change that I made in my environment, which is setting GOPATH. unset GOPATH and now everything works. The odd thing is that the project is outside the GOPATH and has go.mod, everything seems to be on module mode, but if there is a GOPATH set in my env the go commands fails with these odd error messages
Related questions