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: missing dot in first path element #34184

Open
damozhiying opened this issue Sep 9, 2019 · 23 comments

Comments

@damozhiying
Copy link

commented Sep 9, 2019

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屏幕截图

@damozhiying

This comment has been minimized.

Copy link
Author

commented Sep 9, 2019

2019-09-09 16-00-15屏幕截图

@ALTree ALTree added the modules label Sep 9, 2019

@ALTree ALTree changed the title missing dot in first path element cmd/go: missing dot in first path element Sep 9, 2019

@antong

This comment has been minimized.

Copy link
Contributor

commented Sep 9, 2019

I typed in the code in the screenshot and ran the code without any error with the same go version you have. @damozhiying , could you include all the information that is in the issue template, including go env output. Also, it would be much easier if you would post as text and not images.

@katcipis

This comment has been minimized.

Copy link

commented Sep 9, 2019

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

@bcmills

This comment has been minimized.

Copy link
Member

commented Sep 10, 2019

@katcipis, @damozhiying: as @antong notes, we need concrete steps to reproduce the problem.

Please fill out the complete issue template, and provide specific commands — as text that we can easily copy and paste — that we can run to reproduce the problem.

@maniLonkar

This comment has been minimized.

@bcmills

This comment has been minimized.

Copy link
Member

commented Sep 12, 2019

@maniLonkar, brew install go is not a command supported by the Go team. If you are observing this issue, please provide steps to reproduce it either starting from source or using the official distribution from https://golang.org/dl.

@deavid

This comment has been minimized.

Copy link

commented Sep 14, 2019

Just ran on the same problem while doing the Go tour in spanish:
https://gotour-es.appspot.com/#45

build command-line-arguments: cannot load tour/wc: malformed module path "tour/wc": missing dot in first path element

The english version seems corrected:
https://tour.golang.org/moretypes/23

Something has changed recently

@amossc

This comment has been minimized.

Copy link

commented Sep 16, 2019

I hit this error when following the instructions to install gopls:

GO111MODULE=on go get golang.org/x/tools/gopls@latest
go: finding golang.org/x/tools latest
go: finding golang.org/x/tools/gopls v0.1.5
go: downloading golang.org/x/tools v0.0.0-20190916020655-1ccc110ba9df
go: downloading golang.org/x/tools/gopls v0.1.5
go: extracting golang.org/x/tools v0.0.0-20190916020655-1ccc110ba9df
go: extracting golang.org/x/tools/gopls v0.1.5
go: downloading golang.org/x/tools v0.0.0-20190911225940-c7d52e45e2f2
go: extracting golang.org/x/tools v0.0.0-20190911225940-c7d52e45e2f2
go: downloading golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7
go: downloading golang.org/x/sync v0.0.0-20190423024810-112230192c58
go: extracting golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7
go: extracting golang.org/x/sync v0.0.0-20190423024810-112230192c58
go: finding golang.org/x/tools v0.0.0-20190911225940-c7d52e45e2f2
build golang.org/x/tools/gopls: cannot load bufio: malformed module path "bufio": missing dot in first path element
$ go version
go version go1.13 darwin/amd64

Instructions taken from: https://github.com/golang/go/wiki/gopls

@bcmills

This comment has been minimized.

Copy link
Member

commented Sep 16, 2019

@amossc, please include the output of go env.

Are you using the official Go distribution, or something installed via brew?

@HuanGong

This comment was marked as off-topic.

Copy link

commented Sep 18, 2019

same issue here, Nightmare...

1 similar comment
@InfernoEmperor

This comment was marked as off-topic.

Copy link

commented Sep 18, 2019

same issue here, Nightmare...

@me440378

This comment was marked as off-topic.

Copy link

commented Sep 18, 2019

May I ask how to fix this problem?

@me440378

This comment has been minimized.

Copy link

commented Sep 18, 2019

I found that if you set the GOROOT right,the problem would be solved.

@ALTree

This comment has been minimized.

Copy link
Member

commented Sep 18, 2019

@bcmills In #34245 (dup of this one) @maniLonkar reported that Installing Go from brew appears to fix the issue, so I'm guessing that this only hits people that installed Go from the official distribution. In that issue, the output of go env was also pasted.

@HuanGong @InfernoEmperor just writing that you have the same issue doesn't help much. Can you please 1) write here how you installed Go 2) paste here the output of Go env 3) provide steps to reproduce the issue (i.e. a sequence of terminal commands that trigger the error). Thanks.

@wanghaolonggit

This comment has been minimized.

Copy link

commented Sep 18, 2019

怎么解决的?

@me440378

This comment has been minimized.

Copy link

commented Sep 18, 2019

怎么解决的?

我把GOROOT的环境变量重新设置为了GO的安装路径就解决了,如果你的GOROOT环境变量的内容不是GO的安装路径可以试试

@mjyuser

This comment has been minimized.

Copy link

commented Sep 18, 2019

when I use /usr/local/go/bin/go1.13 env -w GOPROXY=https://goproxy.cn,direct && /usr/local/go/bin/go1.13 env -w GOPRIVATE=git.kuainiujinke.com && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 /usr/local/go/bin/go1.13 build -o feature --tags release main.go in jenkins, occur this error, the machine conf version is Linux version 4.9.87-linuxkit-aufs (root@95fa5ec30613) (gcc version 6.4.0 (Alpine 6.4.0) ) #1 SMP Wed Mar 14 15:12:16 UTC 2018, go version go1.13 linux/amd64

@bcmills

This comment has been minimized.

Copy link
Member

commented Sep 18, 2019

@me440378, @wanghaolonggit: it is usually best to leave the GOROOT environment variable unset. It has not been necessary for a long time — perhaps since Go 1.0?

(See https://dave.cheney.net/2013/06/14/you-dont-need-to-set-goroot-really.)

@bcmills

This comment has been minimized.

Copy link
Member

commented Sep 18, 2019

@mjyuser, please provide steps to reproduce the problem without using Jenkins. (Given the information that @me440378 provided, it probably has something to do with the process's environment.)

@me440378

This comment has been minimized.

Copy link

commented Sep 18, 2019

@mjyuser, please provide steps to reproduce the problem without using Jenkins. (Given the information that @me440378 provided, it probably has something to do with the process's environment.)

As you said, it may not be related to GOROOT? I started by making a soft link file of go executable file into the bin directory of my home directory, set the home directory to GOROOT, and set GOBIN to GOROOT/bin. After that, I got into trouble. This problem is solved when I reset GOROOT to the GO installation directory.

@doug4j

This comment has been minimized.

Copy link

commented Sep 18, 2019

I was getting missing dot in first path element error but then discovered the module name in my go.mod when it was module github.com/doug4j/templ (note: the user name should be doug4j NOT doug4 I got the following error on go mod tidy:

github.com/doug4/templ/go/cmd/templ imports
	github.com/doug4j/templ/go/cmd/templ/cmd: module github.com/doug4j/templ@latest (v0.0.0-20180620223934-65a7663df59d) found, but does not contain package github.com/doug4j/templ/go/cmd/templ/cmd
github.com/doug4/templ/go/templcore/tealegxlsx imports
	github.com/doug4j/templ/go/templcore imports
	simpledateformat: malformed module path "simpledateformat": missing dot in first path element
github.com/doug4/templ/go/templcore/tealegxlsx imports
	github.com/doug4j/templ/go/templcore imports
	templ/go/logr: malformed module path "templ/go/logr": missing dot in first path element
github.com/doug4/templ/go/templcore/tealegxlsx imports
	github.com/doug4j/templ/go/templcore imports
	templ/go/templapi: malformed module path "templ/go/templapi": missing dot in first path element
github.com/doug4/templ/go/templcore/tealegxlsx imports
	github.com/doug4j/templ/go/templcore imports
	templ/go/util: malformed module path "templ/go/util": missing dot in first path element

When I put the module name correctly as module github.com/doug4j/templ (with the "j" at the end) all was well.

I didn't have to adjust GOROOT or GOPATH at all.

Just wanted to note this in case it helps someone else.

@mjyuser

This comment has been minimized.

Copy link

commented Sep 19, 2019

@bcmills my local docker have go1.12.9 and go1.13, when i run build, the error reporting
/usr/local/go/bin/go1.13 env -w GOPRIVATE=git.kuainiujinke.com && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 /usr/local/go/bin/go1.13 build -o feature --tags release main.go

i tried @me440378 method, but no success
image

@mjyuser

This comment has been minimized.

Copy link

commented Sep 19, 2019

may be the reason for the image, i built a image of centos 7.6 and installed both versions 1.12 and 1.13, the use of image will be abnormal, but when i build an official go:latest image, the process is successful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.