Having trouble installing golint

712 views
Skip to first unread message

gary.wi...@victoriaplumb.com

unread,
Oct 17, 2018, 11:12:37 AM10/17/18
to golang-nuts
I'm having trouble installing golint. Any idea what the problem could be?

$ go get -u -v github.com/golang/lint/golint
github
.com/golang/lint (download)
package github.com/golang/lint/golint: code in directory /home/gary/Code/go/src/github.com/golang/lint/golint expects import "golang.org/x/lint/golint"

Sam Whited

unread,
Oct 17, 2018, 12:53:50 PM10/17/18
to golan...@googlegroups.com
As the error says, you need to use golang.org/x/lint/golint:

go get -u -v golang.org/x/lint/golint

—Sam
> --
> You received this message because you are subscribed to the Google
> Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


--
Sam Whited
s...@samwhited.com

kalekold

unread,
Oct 17, 2018, 3:48:05 PM10/17/18
to golang-nuts
I've already tried that and the original command still fails.

$ go get -u -v golang.org/x/lint/golint
Fetching https://golang.org/x/lint/golint?go-get=1
Parsing meta tags from https://golang.org/x/lint/golint?go-get=1 (status code 200)
get "golang.org/x/lint/golint": found meta tag get.metaImport{Prefix:"golang.org/x/lint", VCS:"git", RepoRoot:"https://go.googlesource.com/lint"} at https://golang.org/x/lint/golint?go-get=1
get "golang.org/x/lint/golint": verifying non-authoritative meta tag
Fetching https://golang.org/x/lint?go-get=1
Parsing meta tags from https://golang.org/x/lint?go-get=1 (status code 200)
golang
.org/x/lint (download)
Fetching https://golang.org/x/lint?go-get=1
Parsing meta tags from https://golang.org/x/lint?go-get=1 (status code 200)
get "golang.org/x/lint": found meta tag get.metaImport{Prefix:"golang.org/x/lint", VCS:"git", RepoRoot:"https://go.googlesource.com/lint"} at https://golang.org/x/lint?go-get=1
Fetching https://golang.org/x/tools/go/ast/astutil?go-get=1
Parsing meta tags from https://golang.org/x/tools/go/ast/astutil?go-get=1 (status code 200)
get "golang.org/x/tools/go/ast/astutil": found meta tag get.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/go/ast/astutil?go-get=1
get "golang.org/x/tools/go/ast/astutil": verifying non-authoritative meta tag
Fetching https://golang.org/x/tools?go-get=1
Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200)
golang
.org/x/tools (download)
Fetching https://golang.org/x/tools/go/gcexportdata?go-get=1
Parsing meta tags from https://golang.org/x/tools/go/gcexportdata?go-get=1 (status code 200)
get "golang.org/x/tools/go/gcexportdata": found meta tag get.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/go/gcexportdata?go-get=1
get "golang.org/x/tools/go/gcexportdata": verifying non-authoritative meta tag
Fetching https://golang.org/x/tools/go/internal/gcimporter?go-get=1
Parsing meta tags from https://golang.org/x/tools/go/internal/gcimporter?go-get=1 (status code 200)
get "golang.org/x/tools/go/internal/gcimporter": found meta tag get.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/go/internal/gcimporter?go-get=1
get "golang.org/x/tools/go/internal/gcimporter": verifying non-authoritative meta tag

$ go
get -u -v github.com/golang/lint/golint
github
.com/golang/lint (download)
package github.com/golang/lint/golint: code in directory /media/Data/Projects/Go/src/github.com/golang/lint/golint expects import "golang.org/x/lint/golint"

Jason Phillips

unread,
Oct 17, 2018, 4:43:37 PM10/17/18
to golang-nuts
Why do you think the first command (at golang.org) failed? Looks like everything worked to me.

Sam Whited

unread,
Oct 17, 2018, 5:05:48 PM10/17/18
to golan...@googlegroups.com
TL;DR — you don't need to run the second command, just the first one.

I'm sorry for being unclear. Go get looks up packages by their import path. The import path of golint is "golang.org/x/lint/golint", so the second command you ran with the github URL will never work since that is the repo, not the package path. When you run go get golang.org/x/lint/golint it will look up the repo, discover that it lives at GitHub, clone it, and build it.

If you don't specify another package import path and you host your source on GitHub the github.com url is the default one, which may be why you are confused. However, golint specifies a custom import path (golang.org/x/lint/golint) so you need to use that.

—Sam
> > On Wed, Oct 17, 2018, at 10:12, gary.wi...@victoriaplumb.com <javascript:>
> > wrote:
> > > I'm having trouble installing golint. Any idea what the problem could
> > be?
> > >
> > > $ go get -u -v github.com/golang/lint/golint
> > > github.com/golang/lint (download)
> > > package github.com/golang/lint/golint: code in directory
> > /home/gary/Code/go/
> > > src/github.com/golang/lint/golint expects import "
> > golang.org/x/lint/golint"
> > >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "golang-nuts" group.
> > > To unsubscribe from this group and stop receiving emails from it, send
> > > an email to golang-nuts...@googlegroups.com <javascript:>.
> > > For more options, visit https://groups.google.com/d/optout.
> >
> >
> > --
> > Sam Whited
> > s...@samwhited.com <javascript:>

kalekold

unread,
Oct 24, 2018, 5:29:09 PM10/24/18
to golang-nuts
It must have been a configuration issue on the remote server because it all works fine now.
Reply all
Reply to author
Forward
0 new messages