| ▲ | lelandbatey 9 hours ago | |
Even easier than that, you can use the 'replace' statement in your go mod to change where the Go build system will try to pull the dependencies from; you can point to a folder on disk or to another forge, and if you want total control you can indirect everything to your own artifact cache via GOPROXY (which can be something as simple as a static folder of source code). The "module name is network path" is a convenient convention but not at all some "limitation" of the tooling. | ||
| ▲ | quectophoton 2 hours ago | parent | next [-] | |
> you can use the 'replace' statement in your go mod to change where the Go build system will try to pull the dependencies from Heads up for anyone who doesn't know: this only works at the "top level". Any replace directives in your dependencies will be ignored[1]. So for example if you have a dependency tree like [main -> thirdpartyframework -> golang.org/x/net/http2], and thirdpartyframework uses a vulnerable version of `golang.org/x/net/http2`, you can't just fix it by patching the thirdpartyframework repository with a replace directive; no, because that would be too convenient. Instead, the replace directive needs to be at the main module, where it doesn't make sense and is inconvenient. Even though I like Go, it really seems like they don't care about anything other than monorepos. As soon as you need to work with forks, mirrors, or even just private modules[2][3], the tooling actively works against you. Also using your custom module proxy is a pain. [1] See: https://go.dev/ref/mod#go-mod-file-replace:~:text=replace%20... [2]: If you've only used private modules hosted on GitHub you might not have noticed too much pain because the Go tooling has hardcoded behavior specifically for GitHub and a few mainstream forges. You don't find out about this until you try to self-host something like Forgejo on your own domain thinking it would Just Work(tm), but it doesn't, and now you're left wondering why tf it works with GitHub but not with your own forge instance. [3]: I think there's no hardcoded code for SourceHut, so you might be able to experience the inconvenience by hosting private modules in there. | ||
| ▲ | mort96 9 hours ago | parent | prev [-] | |
And now all your source files contain URLs to abandoned infrastructure. Is that what you'd want long term? | ||