go get命令下载某些包时会出现错误,其实可以通过https://gopm.io 下载,但是godep需要包必须使用版本控制,所以在可以让go get使用代理来解决。
C:\Users\minho>go get -v gopkg.in/fatih/pool.v2Fetching https://gopkg.in/fatih/pool.v2?go-get=1https fetch failed.Fetching http://gopkg.in/fatih/pool.v2?go-get=1import "gopkg.in/fatih/pool.v2": http/https fetch: Get http://gopkg.in/fatih/pool.v2?go-get=1: dial tcp 107.178.216.236:80: ConnectEx tcp: A connection attemptfailed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.package gopkg.in/fatih/pool.v2: unrecognized import path "gopkg.in/fatih/pool.v2"
这个时候可以设置“http_proxy”和“https_proxy”来实现代理翻墙。
C:\Users\minho>set https_proxy=127.0.0.1:8580C:\Users\minho>set http_proxy=127.0.0.1:8580C:\Users\minho>go get -v gopkg.in/fatih/pool.v2Fetching https://gopkg.in/fatih/pool.v2?go-get=1Parsing meta tags from https://gopkg.in/fatih/pool.v2?go-get=1 (status code 200)get "gopkg.in/fatih/pool.v2": found meta tag main.metaImport{Prefix:"gopkg.in/fatih/pool.v2", VCS:"git", RepoRoot:"https://gopkg.in/fatih/pool.v2"} at https://gopkg.in/fatih/pool.v2?go-get=1gopkg.in/fatih/pool.v2 (download)gopkg.in/fatih/pool.v2
git config --global https.proxy http://127.0.0.1:1080git config --global https.proxy https://127.0.0.1:1080git config --global --unset http.proxygit config --global --unset https.proxy