用过go的同学都知道go get …… 是一个漫长的过程,既然python 有pip国内镜像,node 也有国内镜像,那go是否有类似的镜像呢?确实有go mod + goproxy 可参考http://mirrors.aliyun.com/goproxy/,具体怎实现呢?
- 在环境变量中加入GOPROXY值为https://mirrors.aliyun.com/goproxy/
- 新建一个文件夹test
- 在test下执行go mod init test
- 新建main.go
- 写入代码
package main import "github.com/kataras/iris" func main() { app := iris.New() app.Get("/", func(ctx iris.Context){}) app.Run(iris.Addr(":8080")) }
-
go run main.go 就可以感受到飞速的get依赖包了。