在作更新時,收到下面提示:html
go get github.com/astaxie/beego
go install runtime/cgo: open /usr/local/go/pkg/darwin_amd64/runtime/cgo.a: permission deniedgit
看目錄下,也沒有cgo.a 文件。github
因此是找不到這個文件報的錯誤,而不是沒有權限的問題。經過sudo來設置權限是不能解決這個問題的。golang
http://www.cnblogs.com/ghj1976/archive/2013/05/17/3084006.html
http://grokbase.com/p/gg/golang-china/135gh2bj5p/gocn-9214-%E5%8D%87%E7%BA%A7%E5%88%B0go1-1%E5%90%8E%EF%BC%8C-go-get-u-%E6%97%A0%E6%B3%95%E6%9B%B4%E6%96%B0%EF%BC%8C%E7%AB%9F%E7%84%B6%E6%8F%90%E7%A4%BA-cannot-download-gopath-not-setgoogle
解決方法:code
禁用CGOhtm
export CGO_ENABLED=0blog
而後再執行go get 命令。get
緣由:it
It's a problem with your Go installation. Similar issues are reported there and there. I may only add that on Mac version from Homebrew works just fine.
參考: https://github.com/AlekSi/nut/issues/26交叉編譯時,會丟掉cgo.a 文件。