go install github.com/mdempsky/gocode@latest
go: github.com/mdempsky/gocode@latest: module github.com/mdempsky/gocode: Get "https://proxy.golang.org/github.com/mdempsky/gocode/@v/list": dial tcp 142.251.43.17:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
设置代理:
$ go env -w GO111MODULE=on
$ go env -w GOPROXY=https://goproxy.io,direct
再次执行go install
PS D:\Projects\tools> go env -w GO111MODULE=on
PS D:\Projects\tools> go env -w GOPROXY=https://goproxy.io,direct
PS D:\Projects\tools> go install github.com/mdempsky/gocode@latest
go: downloading github.com/mdempsky/gocode v0.0.0-20200405233807-4acdcbdea79d
go: finding module for package golang.org/x/tools/go/gcexportdata
go: downloading golang.org/x/tools v0.19.0
go: found golang.org/x/tools/go/gcexportdata in golang.org/x/tools v0.19.0