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: `go get -u golang.org/x/lint/golint` fails in module mode #26380

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

Comments

Projects
None yet
6 participants
@ainar-g
Copy link
Contributor

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/lint@v0.0.0-20180702182130-06c8688daad7 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/lint@v0.0.0-20180702182130-06c8688daad7

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link

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/tools@v0.0.0-20180803180156-3c07937fe18c provides golang.org/x/tools/cmd/goimports
@bcmills

This comment has been minimized.

Copy link
Member

commented Aug 3, 2018

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

@thepudds

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

commented Aug 7, 2018

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

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