Thinking——glide在windows上的一個bug

來源:互聯網
上載者:User
這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。

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

不過,之後應該很快會修複掉這個問題的^_^

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.