BC 2019-06-26
glide是Go的一个依赖管理工具(非官方的),我下载了0.13.1这个Release版本,然后发现在windows上执行glide install
后出错
[ERROR] Unable to export dependencies to vendor directory: Error moving files: exit status 1. output: Access is denied. 0 dir(s) moved
google一下发现原因在于github.com/Masterminds/glide/path/winbug.go里的CustomRename函数
func CustomRename(o, n string) error { // Handking windows cases first if runtime.GOOS == "windows" { msg.Debug("Detected Windows. Moving files using windows command") cmd := exec.Command("cmd.exe", "/c", "move", o, n) output, err := cmd.CombinedOutput() if err != nil { return fmt.Errorf("Error moving files: %s. output: %s", err, output) }
发生错误行在cmd := exec.Command("cmd.exe", "/c", "move", o, n)这里,调用windows上move函数发生权限错误。
google一下可以改为(根据原来的提交记录):
cmd := exec.Command("cmd.exe", "/c", "xcopy /s/y", o, n+"\\")
在glide源码目录重新编译生成glide.exe,然后放到$GOPATH/bin目录下(记得把这个目录放到环境变量PATH里)
不过,之后应该很快会修复掉这个问题的^_^