Thinking——glide在windows上的一个bug

Salamander · · 788 次点击 · · 开始浏览    
这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。

glide

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里)

不过,之后应该很快会修复掉这个问题的^_^


有疑问加站长微信联系(非本文作者)

本文来自:Segmentfault

感谢作者:Salamander

查看原文:Thinking——glide在windows上的一个bug

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

788 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传