profile
viewpoint

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 2019-09-09 15-56-23屏幕截图

golang/go

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

useful!

Related questions

cmd/link: segmentation fault during mach-o linking
cmd/go: cannot find module providing package error stops `go get` processing hot 3
vendor/golang.org/x/xerrors/adaptor_go1_13.go:16:14: undefined: errors.Frame ... hot 2
cmd/vet: potential false positive in the "suspect or" check hot 2
internal/poll: transparently support new linux io_uring interface hot 2
x/xerrors: fails to compile on tip hot 1
cmd/go: `go clean <package>` downloads modules hot 1
cmd/cgo error: runtime: unknown pc 0x7fff5c805b86 hot 1
runtime: crash with "invalid pc-encoded table" hot 1
cmd/link: showing many ld warnings of "building for macOS, but linking in object file" hot 1
runtime: go program crach, it seems fall into infinite loop hot 1
cmd/go: major version without preceding tag must be v0, not v1 - breaks build of github.com/go-check hot 1
gollvm: Using External Go Packages with gollvm hot 1
runtime: macOS Sierra builders spinning hot 1
cmd/go: Problem using go modules hot 1
Github User Rank List