by bonn1 · 11y ago · 0 comments
It does completely sidestep version dependencies hell and encourages you to think carefully about which dependencies you package. It does that by making you manually responsible for keeping dependencies up to date if you distribute other people's code with your own.
So, in answer to your original question, no go doesn't finally have a package manager with proper versioning (at least no official one). In practice, this is not as big an issue as you might think if you come from a language with such a package manager. In practice, I haven't really found it as much of a burden as I thought I might.
For example, when I released v1 of my package "lumberjack" you imported it with
import "github.com/natefinch/lumberjack"
When I updated it to v2, I had to change the url. Luckily there's http://gopkg.in to make this easy, so for v2 it's import "gopkg.in/natefinch/lumberjack.v2"
Note that the above url actually redirects to the v2 branch of the same github repo.There are multiple ways to solve these problems (vendoring is one, your solution another, godep another path), but the go get tool doesn't explicitly allow for versioning in the way the parent requested and there is no official solution to this.
The official solution to versioning is separate URLs. If you mean something more complicated like automatic resolution of different version specifications (e.g. ver >= 1.2), then no, nothing exists like that. But generally all you need is "project A uses version foo, and project B uses version bar", and Go supports that just fine.
Vendoring your deps is currently the only certain way to get stable versioning.
It's not really a package manager, though you can get some of the same results. It's more pulling in exact build dependencies.