Re:Why Go is elegant and makes my code elegant
by mediocregopher on Wednesday April 09, 2014 @05:02PM
(#7562369)
Basically to install a dependency you do something like "go get github.com/mediocregopher/somelib", and the tool will fetch it and put in the appropriate spot on your GOPATH. So the universal name of your package is also the address the package is retrieved from. You COULD host the package multiple places and it wouldn't be true that it would be unique in the whole universe, but that's up to you.
Re:Why Go is elegant and makes my code elegant
by robert_tweed on Wednesday April 09, 2014 @05:09PM
(#7562415)
Same way it works in Java: by convention. You use the repository URL on e.g., github in the package name, so if that URL is unique then your package name is unique.
It rather relies on the assumption that you do have one unique canonical URL associated with your package for this to work, but one of the things about go is that a lot of it is based on pragmatic assumptions that turn out to be true often enough that the edge cases don't matter.
If you use go get, it can auto-download any such publicly hosted packages, which is a nice feature, especially as it can get the dependencies for you as well.
How does that work?