2
submitted 3 days ago* (last edited 3 days ago) by tapdattl@lemmy.world to c/golang@programming.dev

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!!

you are viewing a single comment's thread
view the rest of the comments
[-] tapdattl@lemmy.world 3 points 3 days ago

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 6 points 3 days ago* (last edited 3 days ago)

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.

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

https://go.dev/ref/mod#environment-variables

[-] tapdattl@lemmy.world 2 points 2 days ago

Yup this fixed it -- adding GOPRIVATE=code.mydomain.com as an environment variable allowed go get and go mod tidy to work with my private repos.

Is there a way to set this globally, or to configure Go to always treat any references to code.mydomain.com as a private URL?

[-] who@feddit.org 4 points 2 days ago* (last edited 2 days ago)

The go env -w command can make most go environment variable settings persistent for the current user. Alternatively, you could set the environment variable in your shell's login script.

Be sure to read go's docs for individual environment variables, because go doesn't respect all methods of setting them in every case. (For example, it ignores certain approaches to disabling its telemetry. How convenient for Google.)

this post was submitted on 29 May 2026
2 points (100.0% liked)

Golang

2692 readers
1 users here now

This is a community dedicated to the go programming language.

Useful Links:

Rules:

founded 3 years ago
MODERATORS