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_proxyandhttps_proxyenvironment variables are setno_proxydoes not contain the IP or hostname of my Go-ProxyGOPROXYis set (go env -w GOPROXY=https://artifactory.mycompany.com/api/go/myrepo-go-virtual)
I checked:
- Using curl and directly querying the GOPROXY server works fine and I can download the file (so the https_proxy setting works)
- Counter-check with curl and explicitly unsetting http/https_proxy: No connection, as expected
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)