這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。
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裡)
不過,之後應該很快會修複掉這個問題的^_^