]> Cypherpunks repositories - gostls13.git/commit
cmd: disable *.go domains lookup in go get command
authorAnton Kuklin <anton.a.kuklin@gmail.com>
Fri, 24 Apr 2020 23:33:30 +0000 (02:33 +0300)
committerJay Conrod <jayconrod@google.com>
Thu, 30 Apr 2020 22:06:07 +0000 (22:06 +0000)
commit4c78d54fdd9ffc81c15ffc3c4a2946f89d4fca22
treeede3514ed301845773521997f9446e8eac508f16
parent00753d52323c466b7c9f998a7ec3dd0b1d63366f
cmd: disable *.go domains lookup in go get command

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 #38478

Change-Id: I583a4ef7f7ca8901deb07ebc811e2b3c0e828fa6
Reviewed-on: https://go-review.googlesource.com/c/go/+/229938
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/go/internal/get/get.go
src/cmd/go/internal/modget/get.go
src/cmd/go/testdata/script/get_go_file.txt [new file with mode: 0644]
src/cmd/go/testdata/script/mod_get_go_file.txt [new file with mode: 0644]