Reputation: 482
I'm trying to install golint with the command: go get -u golang.org/x/lint/golint
.
And I think I got two problems:
go get: warning:
modules disabled by GO111MODULE=auto in GOPATH/src;
ignoring ../go.mod;
see 'go help modules'
package golang.org/x/lint/golint:
unrecognized import path "golang.org/x/lint/golint" (https fetch: Get https://golang.org/x/lint/golint?go-get=1: dial tcp 216.58.200.192:443: i/o timeout)
I then try to install golang/tools, also failed...
package golang.org/x/tools: unrecognized import path "golang.org/x/tools" (https fetch: Get https://golang.org/x/tools?go-get=1: dial tcp 216.58.200.192:443: i/o timeout)
Upvotes: 41
Views: 106848
Reputation: 41
I use go env -w GO111MODULE=on
and just run this: go install github.com/beego/bee@latest
and it works
Upvotes: 0
Reputation: 743
type following on command line or powershell:
go env -w GO111MODULE=on
should solve your problem
Upvotes: 24
Reputation: 2824
I ran this command
export GO111MODULE="on"
and that worked for me...
Upvotes: 95
Reputation: 792
Also got this error when trying to work with vgo
Removing GOROOT (you don't need to explicitly set GOROOT
, Modern versions of Go can figure it out on their own based on the location of the go binary that you run), updating my GOPATH and export GO111MODULE="on"
resolved the issue.
GOPATH see in here
GOPATH may be set to a colon-separated list of paths inside which Go code, package objects, and executables may be found.
Set a GOPATH to use goinstall to build and install your own code and external libraries outside of the Go tree (and to avoid writing Makefiles).
Upvotes: 28
Reputation: 7477
It looks like you have a go.mod
file inside $GOPATH/ (under $GOPATH/go.mod
). You should remove that. Also, since you are using Go 1.11 or newer, you can run the go get
command from well outside of GOPATH/any directory containing a go.mod
file either directly or in a parent directory, and then the command should work.
Upvotes: 8