GoLand golang1,12 科学下载第三方包

自学golang,想下个gorm 和 iris 玩玩,没想到光安装一些第三方包竟然折腾了半个月。好在这周末误打误撞终于搞好了。记录一下吧。

我用的是MAC ,GoLand 2019.2, golang 1.12 版本。

安装第三方包的方法一般会有两种情况,一种是直接

go get -u http://github.com/kataras/iris

这种,但是我一开始下了几次发现没有安好,有好几次下到最后就挂了。
还有一种方法是直接自己下载github上的包,然后自行手动安装

一般两步,先在GOPATH下面的src文件夹下建立对应的文件夹,然后到相应的文件夹下进行git clone操作
git clone 对应的包
然后
go install 包

网上好多教程都会有上面方法的介绍,但是我就是按照上面的方法试,搞了好久都没有成功。崩溃边缘。问题是我还连着V..P..N呢,真是奇了怪了。

unrecognized import path "golang.org/x/crypto
go: google.golang.org/[email protected]: unrecognized import path "google.golang.org/grpc" (https fetch: Get https://google.golang.org/grpc?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: google.golang.org/[email protected]: unrecognized import path "google.golang.org/grpc" (https fetch: Get https://google.golang.org/grpc?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: finding github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/time" (https fetch: Get https://golang.org/x/time?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/sys" (https fetch: Get https://golang.org/x/sys?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/tools" (https fetch: Get https://golang.org/x/tools?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: google.golang.org/[email protected]: unrecognized import path "google.golang.org/genproto" (https fetch: Get https://google.golang.org/genproto?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)

然后就要介绍神奇的方法了,
https://studygolang.com/articles/22670

就是这篇文章里介绍的方法,在设置里找到GO-GO MODULE-Proxy 然后写上以下网址: https://goproxy.io

然后就神奇的可用了,转给和我一样情况的使用。

猜你喜欢

转载自blog.51cto.com/fulin0532/2432311