golang-glide win10에서 "dependencies to vendor directory: Error moving files"오류 해결

5049 단어 go
gopath 찾기: 다음 파일 github.com\Masterminds\glide\path\winbug.go는 다음 함수를 수정합니다.
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()
		//fmt.Println("CustomRename:",output,err)
		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로 컴파일합니다.exe, 환경 변수 경로 아래 [$gopath/bin]을 놓습니다.

좋은 웹페이지 즐겨찾기