I'm trying to get Go to use an internal enterprise Go-Proxy for module download - which requires an http_proxy to be accessible (enterprise firewall). However go get -u golang.org/x/lint/golint fails:
package golang.org/x/lint/golint: unrecognized import path "golang.org/x/lint/golint": https fetch: Get "https://golang.org/x/lint/golint?go-get=1": Forbidden
My setup:
http_proxy and https_proxy environment variables are setno_proxy does not contain the IP or hostname of my Go-ProxyGOPROXY is set (go env -w GOPROXY=https://artifactory.mycompany.com/api/go/myrepo-go-virtual)I checked:
Using tcpdump, I discovered that running go get seems to ignore my GOPROXY and ask my http_proxy to connect directly to the original url on golang.org (Options/sequence and ack numbers omitted for brevity), which the proxy/firewall blocks.
06:52:53.926397 IP <my_ip.port> > <proxy.port>: Flags [S], length 0
06:52:53.927206 IP <proxy.port> > <my_ip.port>: Flags [S.], length 0
06:52:53.927232 IP <my_ip.port> > <proxy.port>: Flags [.], length 0
06:52:53.932003 IP <my_ip.port> > <proxy.port>: Flags [P.], length 89: HTTP: CONNECT golang.org:443 HTTP/1.1
06:52:53.932638 IP <proxy.port> > <my_ip.port>: Flags [.], length 0
06:52:53.933100 IP <proxy.port> > <my_ip.port>: Flags [P.], length 3939: HTTP: HTTP/1.1 403 Forbidden
Question: Why does Go ignore the GOPROXY? Did I not set something up correctly?
I'm using Go 1.15.3 in the golang:1.15.3 Docker container (with some added tools to check connectivity)
Try this: set GO111MODULE=on to use GOPROXY
Or run go mod init before you run go get
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With