bug重現
[ERROR] Unable to export dependencies to vendor directory: Error moving files: exit status 1. output: Access is denied. 0 dir(s) movedgit
第一步github
//找到這個文件 github.com/Masterminds/glide/path/winbug.go // CustomRename is similar to os.Rename but deals with the bug outlined // at https://github.com/golang/go/issues/20841. 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) //將這行代碼修改成 cmd := exec.Command("cmd.exe", "/c", "xcopy /s/y", o, n+"\\") output, err := cmd.CombinedOutput() if err != nil { return fmt.Errorf("Error moving files: %s. output: %s", err, output) } return nil } else if detectWsl() { cmd := exec.Command("mv", o, n) output, err2 := cmd.CombinedOutput() msg.Debug("Detected Windows Subsystem for Linux. Removing files using subsystem command") if err2 != nil { return fmt.Errorf("Error moving files: %s. output: %s", err2, output) } return nil } return os.Rename(o, n) }
第二步,從新編譯glide.go文件golang
go build glide.go
第三步,將編譯生成的可執行文件glide.exe,複製到gopath下的bin目錄(這個目錄是加了系統環境變量的,因此將其放入該目錄)windows
第四步,更詳細的討論解決方案 https://github.com/Masterminds/glide/issues/873ide