One - One Code All

Blog Content

go语言引用github包

Go   2012-05-06 17:12:09


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% 中定义的路径去查找第三方类库
)


上一篇:python list求index便捷方法
下一篇:thinkphp volist循环数组的key名和自增序号

The minute you think of giving up, think of the reason why you held on so long.