138 points · by eandre · 5y ago · 50 comments
[0] https://golang.cafe/blog/how-to-upgrade-golang-dependencies....
[1] https://github.com/golang/go/wiki/Modules#how-to-upgrade-and...
git config --global url.git@HOSTNAME:.insteadOf https://HOSTNAME/[0] - https://blog.bramp.net/post/2017/10/02/vanity-go-import-path...
See xyzc.dev/go/ppgen and inspect the source for an example.
Thank you.
Also, Go modules are dependent on DNS, so any domain name change for your repo will have to result in code (import path) changes.
Modules are not for monorepos and internal components, modules are for third party dependencies that need to be pulled in at compatible versions, and for general multirepo work.
This is trivial to do with any other module system I've used (Maven, Nuget, Konan, pip, cargo), but it is extraordinarily brittle with Go.
"/v2", git tags but not branches, and the blast radius of trying to use a forked dependency: Golang's awful module system is top of my list for reasons to recommend away from golang. The design is full of weird kludges and your choices are zero documentation or overwhelming documentation that obscures what you really need.
This is considering the fact that nixpkgs has Go module support.
You can even use Nix's recursive, lazy nature to declare dependencies between libraries too in an equally lighweight way as go mod.
However, this is a lost cause at this point. Go is removing GOPATH support in the next release (Go 1.17). See: https://blog.golang.org/go116-module-changes