一、命令
安装
$ go get github.com/Masterminds/glide
$ go install github.com/Masterminds/glide 初始化项目并在当前项目下创建glide.yaml文件
glide create
glide init 更新解析下载包依赖
glide update
glide up 安装依赖包到当前项目的vendor目录下
glide install 获取单个包
glide get
--all-dependencies 会下载所有关联的依赖包
-s 删除所有版本控制,如.git
-v 删除嵌套的vendor 查看
glide name
glide list
glide help
glide --version 清理缓存,缓存位置$HOME/.glide/cache/src
glide cc 设置镜像,镜像映射文件 $HOME/.glide/mirrors.yaml
glide mirror set [original] [replacement]
glide mirror set [original] [replacement] --vcs [type] 移除镜像
glide mirror remove [original] 获取包的镜像列表
glide mirror list
二、报错
、墙的问题
2 [WARN] Unable to checkout golang.org/x/sys/windows
3 [ERROR] Error looking for golang.org/x/sys/windows/svc: Cannot detect VCS
4
5 解决:
6 (1) 设置镜像后可查看$HOME/.glide/mirrors.yaml文件
7 glide mirror set https://golang.org/x/sys https://github.com/golang/sys --vcs git
8 (2) 当前glide.yml追加
9 echo "- package: golang.org/x/sys" >>glide.yaml
10 (3) glide install
11
12
13 2、win10使用glide exit status 1
14 [ERROR] Unable to export dependencies to vendor directory: Error
15 moving files: exit status 1. output: Access is denied. 0 dir(s) moved.
16
17 解决:
18 (1)修改glide
19 vim github.com/Masterminds/glide/path/winbug.go
20 function "func CustomRename(o, n string) error" replace the following line
21 //cmd := exec.Command("cmd.exe", "/c", "copy", o, n)
22 cmd := exec.Command("robocopy.exe", o, n, "/e")
23 (2)重新编译glide
24 go install github.com/Masterminds/glide
【参考】
https://zhuanlan.zhihu.com/p/27994151