Advice for closed network - problem with go mod

316 views
Skip to first unread message

David Arsenault

unread,
Apr 25, 2022, 5:08:48 PM4/25/22
to golang-nuts
Hello. I was hoping to get some smart advice on a problem using go on a closed network. 

Summary:
- closed network, no outside access (painful, I know)
- moved all needed packages to ~/go/pkg...
- using go modules

Problem:
go mod insists on using the network (can't). When I set GOPROXY=off go mod tidy yells then quits:

github.com/Jeffail/gabs/v2: cannot find module providing package github.com/Jeffail/gabs/v2: module lookup disabled by GOPROXY=off

I've tried using replace in go.mod. Same failures. If GOPROXY=off, above error. If GOPROXY is set to default values it fails on network access.

It would be fantastic if there were a way to use go mod and have it look locally first before trying the network. I don't see a way to do that in the docs. I even tied -pkgdir dir from the go build docs and that fails with network access.

Is there a potential that my go install is somehow broken? 

I suppose I could vendor everything but it would be better if the tool would find the packages already copied to the closed network.

Pulling my hair out. Thanks in advance for your advice Gophers!   

David

Sean Liao

unread,
Apr 25, 2022, 5:15:33 PM4/25/22
to David Arsenault, golang-nuts
See https://go.dev/ref/mod#environment-variables

GOPROXY=file://$(go env GOMODCACHE)/cache/download

- sean


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/4a400763-dddb-46d7-abf4-2beb711e1287n%40googlegroups.com.

David Arsenault

unread,
Apr 25, 2022, 5:38:36 PM4/25/22
to golang-nuts
Sean. Brilliant. I don't grasp how I missed the file:// setting. Works beautifully and I am a grateful Gopher. THANK YOU.

Manlio Perillo

unread,
Apr 26, 2022, 6:18:46 AM4/26/22
to golang-nuts
You can also try using workspace support implemented in Go 1.18.

Create a go.work file in ~go/pkg using
`go work init`
and add all your modules using
`go work use -r .`


Manlio Perillo

Reply all
Reply to author
Forward
0 new messages