-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: do not lookup *.go domains #38478
Comments
When we load packages for build commands, we check whether arguments ending with We should check this in |
In my case the file did exist, so let's at least get this check into |
I will try to fix this bug. |
@justplesh It's a little simpler. For each argument, just consider the path (not counting any That should catch common mistakes without breaking real packages. |
Change https://golang.org/cl/229938 mentions this issue: |
Using 'go get x.go' instead of 'go build x.go' or some other go command is a common mistake. By that mistake, a user gets a misleading error message about unsuccessful `x.go` domain lookup. This improvement handles such cases, by validating, whether the argument hasn't specified version, has .go suffix, and either has no slashes or such file locally exists. Handled both GOPATH and GOMOD modes. Fixes golang#38478 Change-Id: I583a4ef7f7ca8901deb07ebc811e2b3c0e828fa6 Reviewed-on: https://go-review.googlesource.com/c/go/+/229938 Reviewed-by: Bryan C. Mills <[email protected]> Reviewed-by: Jay Conrod <[email protected]> Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
I accidentally ran "go get x.go foo" instead of "go run x.go foo".
The go command did:
It should probably instead reject the whole command if the first path ends in
.go
, to make this common mistake fail quicker and with a better error./cc @jayconrod @bcmills @matloob
The text was updated successfully, but these errors were encountered: