dsqve08622 2018-07-06 08:00
浏览 69

如果依赖项尝试从Internet下载,如何配置代理?

I have GoLang

go version go1.10.3 windows/amd64

In our corporate network access to internet only via Proxy.

in git client did set

git config --global http.proxy http://user:password@proxy:8118

It did work for this one

c:\go\bin\go get -u -v github.com/prometheus/client_golang/prometheus

BUT if in new pkg did have a dependency for example

C:\Windows\system32>c:\go\bin\go get -u -v github.com/prometheus/common/log
github.com/prometheus/common (download)
github.com/sirupsen/logrus (download)
Fetching https://golang.org/x/crypto/ssh/terminal?go-get=1
https fetch failed: Get https://golang.org/x/crypto/ssh/terminal?go-get=1: dial tcp 193.184.73.141:4
43: connectex: No connection could be made because the target machine actively refused it.
package golang.org/x/crypto/ssh/terminal: unrecognized import path "golang.org/x/crypto/ssh/terminal
" (https fetch: Get https://golang.org/x/crypto/ssh/terminal?go-get=1: dial tcp 193.184.73.141:443:
connectex: No connection could be made because the target machine actively refused it.)
Fetching https://golang.org/x/sys/windows/svc/eventlog?go-get=1
https fetch failed: Get https://golang.org/x/sys/windows/svc/eventlog?go-get=1: dial tcp 193.184.73.
141:443: connectex: No connection could be made because the target machine actively refused it.
package golang.org/x/sys/windows/svc/eventlog: unrecognized import path "golang.org/x/sys/windows/sv
c/eventlog" (https fetch: Get https://golang.org/x/sys/windows/svc/eventlog?go-get=1: dial tcp 193.1
94.173.141:443: connectex: No connection could be made because the target machine actively refused it
.)
Fetching https://gopkg.in/alecthomas/kingpin.v2?go-get=1
https fetch failed: Get https://gopkg.in/alecthomas/kingpin.v2?go-get=1: dial tcp 135.186.143.184:443
: connectex: No connection could be made because the target machine actively refused it.
package gopkg.in/alecthomas/kingpin.v2: unrecognized import path "gopkg.in/alecthomas/kingpin.v2" (h
ttps fetch: Get https://gopkg.in/alecthomas/kingpin.v2?go-get=1: dial tcp 135.186.143.184:443: connec
tex: No connection could be made because the target machine actively refused it.)

How to configure proxy if a dependency tries to download from internet?

  • 写回答

1条回答 默认 最新

  • duandan4680 2018-07-06 08:55
    关注

    You need to set the http_proxy environment as you did for git.

    Try running set http_proxy=http://user:password@proxy:8118 and then run the go get command

    评论

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类