默認使用的是proxy.golang.org,在國內沒法訪問,以下圖所示:html
bogon:demo-path user$ make build_darwin rm -rf target/demo-0.6.0 mkdir -p target/demo-0.6.0/bin env CGO_ENABLED=1 GO111MODULE=on go run build/spec.go target/demo-0.6.0/bin/demo-spec-0.6.0.yaml go: github.com/StackExchange/wmi@v0.0.0-20190523213315-cbe66965904d: Get "https://proxy.golang.org/github.com/%21stack%21exchange/wmi/@v/v0.0.0-20190523213315-cbe66965904d.mod": dial tcp 34.64.4.17:443: i/o timeout make: *** [build_yaml] Error 1 bogon:demo-path user$ make build_darwin
解決方法:
換一個國內能訪問的代理地址:https://goproxy.cngit
執行命令:github
go env -w GOPROXY=https://goproxy.cn
從新執行命令,完美經過!golang