Tuesday, February 21, 2012

golang go command & dependency management

Finally decent dependency management!
The elephant in the room has always been that the code depends on specific versions of software to build and or run. Once you accept this putting dependencies in the source code is very obvious. A quick comparison of the languages I use most:

Bottom line javascript doesn't really do any dependency management that is left for the most part up to the developer to make sure that all the required packages are included on the page or using some framework. There seems to be some magic possible with coffeescript, GWT or other web frameworks that provide dependency management however are not interoperable. This is nasty as web apps get really large. I am looking to Dart in the future to solve this.

The only real game in town is Maven. The XML file configuration is horrendous IMO especially compared to Ant. The enormous amount of jars and memory needed to compile a simple web service is surprising. Finally the support for maven repository is far from universal.

Probably the best with a combination of virtualenvwrapper, pip and running pip freeze this is by far the fastest and easiest to use until go get command came along. There is still manual tracking of dependencies where even if it is simple "pip freeze > deps.txt".

This is covered pretty completely here (caution for the sensitive the blog is pretty graphic). Bottom line if I have added dependency I run "go get" and they are automatically downloaded from the import statements in my source code. I can run "go build" without any Makefile or build script. Once I has pushed up my library into the interwebs and another library is added to the go world.

This forces the master/default/trunk of the repo to be production. New code must be developed in a branch but isn't that how it should be anyway? The dependency (pom.xml, pip freeze, ect) configuration is commit into the source tree anyway (usually with some additional instructions). Lets hope other languages start supporting this!