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: needs a better error than "missing dot in first path element" when GOROOT is set incorrectly #34184
Comments
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. |
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:
go test ./... and go get ./...:
OS:
Go:
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 |
@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. |
Use https://ahmadawais.com/install-go-lang-on-macos-with-homebrew/ to setup env |
@maniLonkar, |
Just ran on the same problem while doing the Go tour in spanish: build command-line-arguments: cannot load tour/wc: malformed module path "tour/wc": missing dot in first path element The english version seems corrected: Something has changed recently |
I hit this error when following the instructions to install
Instructions taken from: https://github.com/golang/go/wiki/gopls |
@amossc, please include the output of Are you using the official Go distribution, or something installed via |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I found that if you set the GOROOT right,the problem would be solved. |
@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. |
怎么解决的? |
我把GOROOT的环境变量重新设置为了GO的安装路径就解决了,如果你的GOROOT环境变量的内容不是GO的安装路径可以试试 |
when I use |
@me440378, @wanghaolonggit: it is usually best to leave the (See https://dave.cheney.net/2013/06/14/you-dont-need-to-set-goroot-really.) |
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. |
I was getting 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 I didn't have to adjust GOROOT or GOPATH at all. Just wanted to note this in case it helps someone else. |
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 |
@bcmills here is the output of
|
@amossc, please try removing the The |
@gustavolopess, setting In your case, is it possible that |
@xroba, how had you installed the |
This comment has been minimized.
This comment has been minimized.
Nobody seems to be providing information about how the invalid |
@bcmills how is GOROOT supposed to look? I'm having this problem as well using Goland 2019.2.3 (2019-10-01 build) and My company machine is managed by some super long running script that we run every once in a while, and that's likely how I upgraded to 1.13. It wouldn't surprise me at all if the script is using |
Duplicate of #34769. |
What about windows users? I'm using Windows 10 and git's mingw64 terminal. Everything was working until I rebooted my computer. I have no GOROOT set... If I should set it, what do I set it to? |
@Mantic, you want |
@Mantic Note that a closed issue is not the best place to ask questions. See https://golang.org/wiki/Questions. Thanks. |
I'm trying to install "google/api/annotations.proto" and keep getting: when I echo $GOROOT I get an empty result though in my "go env" variables it's set to "/usr/local/go": GO111MODULE="" |
go version go1.13.1 linux/amd64
/home/yx/goproj/src/mysports go evn seems correct, but it reports an error |
@AmitShaul @lobo-a, the instances of this error message that you are getting are correct, and are unrelated to |
I continue to get the same "missing dot" error. Is there an official resolution? Nothing in this chain has helped. |
@eddie-velez, if the path is something in the standard library, then the problem is almost certainly your If the path is not something in the standard library, then the error message is likely accurate, and you need to choose an import path that belongs to a (local or fetchable) module; see https://blog.golang.org/organizing-go-code#TOC_3.. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The discussion on this issue seems to be ranging far from the original issue, and we have a new issue filed to track the underlying problem (a less-than-ideal diagnostic when If folks are seeing the same issue with the same root cause, please see the tracking issue for that diagnostic. If folks are seeing the same issue with a different root cause, please try to diagnose it in your code — and if the error message is missing the information you need in order to do that, please open a new issue with a specific code example and layout that reproduces the problem. |
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
The text was updated successfully, but these errors were encountered: