1.确认安装了git
2.执行命令:go get github.com/vmihailenco/redis ,回车之后会自动下载项目到GOPATH中的src目录下。并且它还会同时执行 go install xxx ,生成 D:\go\gopath\pkg\xxxx 这样的包路径。
3.cd gopath\src\github.com\vmihailenco\redis , 然后 go build 编译,go install 安装。 或者:go install github.com/go-sql-driver/mysql 。
4. 在代码中导入下载的那个第三方包
import (
"github.com/go-sql-driver/mysql" // 从环境变量:%goPath% 中定义的路径去查找第三方类库
)