Setting up Goproxy

Hi Everyone,

Recently I’ve been working on setting up Go for development within our group. I’m in a corporate IT environment where access to the Internet is via proxy/firewall. In general when developers issue go build the action should complete without invoking Internet access. Thus I’m looking at setting up a goproxy.

I’m starting from this project by Aofei Sheng: https[colon]//github[dot]com/goproxy/goproxy

$ ./goproxy
Listen :8080

Then in another session do my go get test (with GOPROXY set correctly):
$ go clean -modcache # begin with a clean $HOME/go
$ go get gopkg[dot]in/ldap.v2
go: downloading gopkg[dot]in/ldap.v2 v2.5.1
go: downloading gopkg[dot]in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d

It works, but don’t be fooled. In this case go get went to the Internet via my https_proxy. Over at the session running goproxy I see this output:

2022/08/13 20:05:29 goproxy: failed to list module versions: go: gopkg.in@latest: unrecognized import path “gopkg.in”: parse https[colon]//gopkg[dot]in/?go-get=1: no go-import meta tags ()

My goproxy.go source is little changed[1] from the example. I’m sure the next step is to figure out how to configure it to find a local copy of gopkg.in I’ve cached (for that I believe I just need to git clone or go get it in a special way that leaves a repo around).

I’ll reply back with what I find. In the mean time, if you happen to have setup goproxy and can give me some pointers that would be great. I’ve only recently started working with Go so I’m still have much to learn.

Cheers,
-Randy
[1] My environment requires HTTPS, so I changed the example for that.
I also posted this on diasp.org (a great Free Software alternative to Facebook).