Does Go language have a packaging system like Maven in Java? I'm trying to see how to do dependency management and if there is a way to do it easily.
Well, no, it does not. And it must be understood that go get
is not a package manager.
Still, there is a couple of things to learn:
This FAQ entry.
Since version 1.5, Go tooling has rudimentary support for "vendoring" — that is, packaging the required dependencies along with the project.
The support is only in the form of treating a special directory named "vendor" at the top level of a project in a special way. The tooling does not provide any sort of managing the contents of that directory. Common approaches to do that include subtree merging and submodules supported by Git (and equivalent facilities of other VC systems) and external tooling (see below).
This suport was made enabled by default in Go 1.6.
There's a host of 3rd-party tools implementing packaging for Go using various approaches to carry out this task.
The seemingly complete list was pointed at by @AlexBrand
but since it's hardly reasonable to try each solution there, I'll give an opinionated hint — based on my own lurking on the Go mailing list — to look at these tools: gb
, glide
, govendor
, godep
.
Please also consider reading this thread on the Go mailing list and the resources it links to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With