背景
go項目,使用glide install命令去下載安裝依賴,依賴中有個github.com/hashicorp/consulgit
問題描述
一直沒法下載安裝依賴成功,報錯以下:github
[ERROR] Export failed for github.com/hashicorp/consul: Unable to export source: exit status 128 [ERROR] Unable to export dependencies to vendor directory: Unable to export source: exit status 128
解決思路
先日了狗表達心情!express
一頓google,發現提供的思路都差很少爲:app
glide cc rm -rf vendor
嘗試了無數次後都是失敗了ide
在google的過程當中,有的人建議貼出debug日誌,無奈最後就本身加上了debug日誌,獲得了以下ui
具體日誌
[ERROR] Export failed for github.com/hashicorp/consul: Unable to export source: exit status 128 [DEBUG] Output was: error: unable to create file C:\\\Users\\\M\\\AppData\\\Local\\\Temp\\\glide-vendor249536483\\\vendor\\\github.com\\\hashicorp\\\consul\\\vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuitauthorizations.go: Filename too long[DEBUG] Unlocking https-github.com-hashicorp-consul [ERROR] Unable to export dependencies to vendor directory: Unable to export source: exit status 128 [DEBUG] Output was: error: unable to create file C:\\\Users\\\M\\\AppData\\\Local\\\Temp\\\glide-vendor249536483\\\vendor\\\github.com\\\hashicorp\\\consul\\\vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuitauthorizations.go: Filename too long
日了狗,看描述大概明白了,glide在執行新建文件的時候發現文件名過長了!!!google
解決辦法
那麼問題就演變成了glide error filename too long的問題了ssr
具體方法:debug
Enable long paths on Windows (requires Windows 10 Anniversary Update or newer): https://superuser.com/a/1119980/97078 Configure git to use long paths: git config --global core.longpaths true (globally) or git config core.longpaths true (per project)
我執行了第二步就解決了問題,那麼大概就是glide 會去使用git去拉取代碼和建立文件了的 日誌
小結
仍是問題的官方日誌靠譜,遇到問題先獲取更多的日誌吧