安装Gin 的两种方式

**方式1:**直接使用go get函数,该情况下,已经配置好go环境变量

go get gopkg.in/gin-gonic/gin.v1

但是,使用该语句的时候,遇见超时的问题,可能是内网或者go get被墙(大概率)的原因,此方法行不通

方法2:先采用git clone方法下载gin包,再使用go install安装

(1)下载到当前终端所在路径:git clone https://github.com/gin-gonic/gin.git

(2)安装:go install github.com/gin-gonic/gin

提示这两个文件夹不存在,于是依然采用git clone下载

参考:https://www.jianshu.com/p/18d1f04be18e

具体语句:

git clone --branch v8.18.2 https://github.com/go-playground/validator.git

git clone --branch v2.2.1 https://github.com/go-yaml/yaml.git

然后将下载下来的包改名,分别为:

gopkg.in\go-playground\validator.v8

gopkg.in\yaml.v2

存放到GOPATH下的

src\github.com\gin-gonic\gin\vendor\gopkg.in

具体依据错误出现的路径提示

再执行:go install github.com/gin-gonic/gin

成功

你可能感兴趣的:(go)