Skip to content

cmd/go: go get -u golang.org/x/lint/golint fails in module mode #26380

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

Closed
ainar-g opened this issue Jul 14, 2018 · 6 comments
Closed

cmd/go: go get -u golang.org/x/lint/golint fails in module mode #26380

ainar-g opened this issue Jul 14, 2018 · 6 comments

Comments

@ainar-g
Copy link
Contributor

ainar-g commented Jul 14, 2018

$ mkdir /tmp/foo && cd /tmp/foo
$ echo 'package foo // import "foo"' > main.go
$ go mod -init
$ go get -u golang.org/x/lint/golint
go get golang.org/x/lint/golint: missing module for import: golang.org/x/[email protected] provides golang.org/x/lint/golint

When I first saw this message, I thought it complained about the fact that I didn't import golang.org/x/lint/golint anywhere in my code. A better error message for such cases would be something like

golang.org/x/lint/golint is a part of golang.org/x/lint module; use go get golang.org/x/[email protected]

Or, even better, if the go tool knows the module I am trying to add, why not just add it?

@oiooj oiooj added the modules label Jul 14, 2018
@oiooj oiooj added this to the Go1.11 milestone Jul 14, 2018
@bcmills
Copy link
Contributor

bcmills commented Jul 16, 2018

if the go tool knows the module I am trying to add, why not just add it?

That is intended to work as of https://golang.org/cl/122396. The fact that it doesn't is #25917, and I think this issue is a duplicate of that one. (Please reopen if it is not.)

@bcmills bcmills closed this as completed Jul 16, 2018
@bcmills bcmills reopened this Jul 17, 2018
@bcmills bcmills changed the title cmd/go: better error message when trying to go get a binary from a module cmd/go: go get -u golang.org/x/lint/golint fails in module mode Jul 17, 2018
@llimllib
Copy link

llimllib commented Aug 3, 2018

Another example that led me here, and which I'll leave here in case it helps somebody google or test:

$ go get golang.org/x/tools/cmd/goimports
go: finding golang.org/x/tools/cmd/goimports latest
go: finding golang.org/x/tools/cmd latest
go: finding golang.org/x/tools latest
go: downloading golang.org/x/tools v0.0.0-20180803180156-3c07937fe18c
go get golang.org/x/tools/cmd/goimports: missing module for import: golang.org/x/[email protected] provides golang.org/x/tools/cmd/goimports

@bcmills
Copy link
Contributor

bcmills commented Aug 3, 2018

Thanks. I'm pretty sure this is another symptom of the root cause described in #26602 (comment).

@thepudds
Copy link
Contributor

thepudds commented Aug 7, 2018

Seen in #modules, and possibly related to this issue:

$ go get github.com/Azure/azure-sdk-for-go/arm/compute@bd73d950fa4440dae889bd9917bff7cef539f86e
go: finding github.com/Azure/azure-sdk-for-go/arm/compute bd73d950fa4440dae889bd9917bff7cef539f86e
go: finding github.com/Azure/azure-sdk-for-go/arm/compute latest
go: finding github.com/Azure/azure-sdk-for-go/arm latest
go get github.com/Azure/azure-sdk-for-go/arm/compute@bd73d950fa4440dae889bd9917bff7cef539f86e: cannot find module providing package github.com/Azure/azure-sdk-for-go/arm/compute

go 11 beta 3
git version 2.18.0.windows.1
the code of interest exists at https://github.com/Azure/azure-sdk-for-go/tree/bd73d950fa4440dae889bd9917bff7cef539f86e
where the code of interest of interest is present in the azure sdk at that commit but not the latest version of the azure sdk

CC @myitcv

@myitcv
Copy link
Member

myitcv commented Aug 7, 2018

@thepudds as discussed on Slack, that scenario is also a symptom of #26602 (comment); just confirmed that it's fixed by https://go-review.googlesource.com/c/go/+/128136

@bcmills
Copy link
Contributor

bcmills commented Aug 7, 2018

Yep, I think at this point we can be pretty confident this is a dup of #26602.

@bcmills bcmills closed this as completed Aug 7, 2018
@golang golang locked and limited conversation to collaborators Aug 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants