I'm "all in" on Go Modules. Mostly, I prefer the experience. In Go development, I've -- perhaps like many others -- treated dependencies as if I worked in a mono repo, each of my projects had its own GOPATH
and I'd often clone from scratch and pull all then-latest versions of dependencies.
Using Modules, I think I'm breaking the best practice:
- For per-commit builds, my projects'
go.mod
file would contain only primary -- and often only one -- explicit dependencies. Effectively, I don't commitgo.mod
and leave my build process to generate it and then the build. My thinking being that, apart from e.g. specific platforms that I'm using, where my familiarity with them means I'm confident in pinning to a specific version, for other dependencies, I'd rather maintain currency and get@vLatest
. - If I get to building releases, I'd then
go mod tidy
and commit the go.mod to source control for the basis of the build.
Besides:
- potentially breaking builds (which is acceptable for currency);
- the absence of
go.sum
and package hashes (which I'm not independently verifying but trusting, e.g.golang.proxy.org
); and - the repetition of pulling dependencies which is unavoidable anyway with my build process,
Is this approach bad?