Closed
Description
$ 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?