Hacker News new | ask | show | jobs
by infogulch 1539 days ago
Good question! The thing that the standard library has that I don't is version aggregation. The problem is not publishing under a single domain, the problem is publishing under a single version. Publishing a bunch of packages that I claim are high quality doesn't help users decide which versions to use, they still have to make this decision on a package-by-package basis. Note that I may be in the middle of a big redesign and some individually-complete packages use the new design but others don't, so you can't just say use the latest of each because they don't all work together yet. In this case I still want to publish each package individually for people who do want fine-grained control, but I wouldn't publish a new version of my "package group" with these versions because they're not integrated yet. My point is that aggregations of verified-interoperable packages is a separate problem domain and existing tools don't suffice to solve it.
1 comments

You could sort of do that using a Go module that points to all your other modules. Then anyone who depends on that will get the versions you specify (at a minimum).

But a problem is that they would also download all the modules you point at, whether they use them or not.

To fix that, the package system would need a "soft dependency" where, if a module exists, it must be at least the version indicated.

Good idea with "soft dependencies". You'd also need to make the go.mod RequireSpec version argument [1] optional so it can be overridden by the module group.

    require example.com/my-module-group 1.2.3
    require example.com/some/module // selects minimum version specified by my-module-group
[1]: https://go.dev/ref/mod#go-mod-file-require

I also noticed Workspaces [2] which I hadn't seen before. They look interesting, but appear to exist for a different purpose. Maybe workspaces with a bunch of replace directives & some cli tooling could emulate a system like what is described here.

[2]: https://go.dev/ref/mod#workspaces