Go Modules in Local/Private Forgejo Instances
from tapdattl@lemmy.world to golang@programming.dev on 29 May 00:59
https://lemmy.world/post/47477369

Bit of a newbie question here, but I’ve set up a local Forgejo server in my homelab that I’m using for personal projects. I’ve created some modules that I want to be able to reference in other local projects.

Trying to run

go get code.mydomainname.com/tapdattl/test

returns

go: downloading code.mydomainname.com/tapdattl/test v1.0.0
go: code.mydomainname.com/tapdattl/test@v1.0.0: verifying module: code.mydomainname.com/tapdattl/test@v1.0.0: reading https://sum.golang.org/lookup/code.mydomainname.com/tapdattl/test@v1.0.0: 404 Not Found
        server response: not found: code.mydomainname.com/tapdattl/test@v1.0.0: unrecognized import path "code.mydomainname.com/tapdattl/test": https fetch: Get "https://code.mydomainname.com/tapdattl/test?go-get=1": dial tcp <my netbird ip address>:443: connect: connection refused

However I know my Forgejo server is up, and I can push to it and clone from it and do all the normal Git workflows. But Go apparently can’t talk to it.

Can anyone explain what’s going on?

Thanks!!

#golang

threaded - newest

tapdattl@lemmy.world on 29 May 01:04 next collapse

Looking at it again, I’m guessing the part where sum.golang.org/lookup tries to query my behind-netbird server is why the lookup is failing. But is there a way to gave Go not rely on an external service like that? Or have it run the query locally instead of from the sum.golang.org server?

who@feddit.org on 29 May 04:46 collapse

This is my first guess, and a facet of my single biggest criticism of Go: the module system they added has an enabled-by-default policy of phoning home to Google servers, which turned an otherwise decent toolchain into spyware.

The GOPRIVATE environment variable may be what you need to avoid that error.

go.dev/ref/mod#private-module-privacy

go.dev/ref/mod#environment-variables

Arghblarg@lemmy.ca on 29 May 01:20 collapse

I don’t know if this will help, but I documented how to configure my Caddy webserver to serve golang vanity URLs here.