1. 程式人生 > >Export failed for github.com/hashicorp/consul: Unable to export source: exit status 128

Export failed for github.com/hashicorp/consul: Unable to export source: exit status 128

discover provider 使用 gpa tps 新建 -c data- mode

背景

go項目,使用glide install命令去下載安裝依賴,依賴中有個github.com/hashicorp/consul

問題描述

一直無法下載安裝依賴成功,報錯如下:

[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

解決思路

先日了狗表達心情!

一頓google,發現提供的思路都差不多為:

glide cc

rm -rf vendor

嘗試了無數次後都是失敗了

在google的過程中,有的人建議貼出debug日誌,無奈最後就自己加上了debug日誌,得到了如下

具體日誌

[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在執行新建文件的時候發現文件名過長了!!!

解決辦法

那麽問題就演變成了glide error filename too long的問題了

具體方法:

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去拉取代碼和創建文件了的

小結

還是問題的官方日誌靠譜,遇到問題先獲取更多的日誌吧

Export failed for github.com/hashicorp/consul: Unable to export source: exit status 128