Thursday, February 12, 2015

Golang with Atlassian Stash

Overall, I am unimpressed with Atlassian Stash. It is missing many of the features that are available on Github, is not open source, and generally feels about 3 years behind the curve.

Using it with go get, we ran into some strange issues both with Stash and go get.

Here are a few links that you can upvote to help Atlassian prioritize native go support:
https://answers.atlassian.com/questions/318264/does-stash-have-go-support
https://answers.atlassian.com/questions/329277/making-git-suffix-for-repository-urls-optional

In the meantime, we got things to kind of work, for the most part...

1. Use .git as a suffix to all your projects and imports. Yes, this makes everything ugly, but by naming logging.git it lets go get know that the repo is using git. If you use gox, you can use the -output flag to name the build output without the .git extension.
2. Add the following redirect in your .gitconfig - it will force go get to use ssh and save a lot of time by not waiting for go get to timeout:
[url "git+ssh://git.foo.net:"]
   insteadOf = https://git.foo.net/
   insteadOf = http://git.foo.net/
   insteadOf = git://git.foo.net
3. Use the -f flag with -u "go get -v -u -f" to update your project.

I hope this helps!