Travis and gb

Go is currently all the hype. Unfortunately dependency management in Go is basicaly non existant. The most common pattern for managing dependencies is vendoring. There are several different approaches to vendoring, but some require you to rewrite your imports. While I think this is bad, other people seem to agree and there exists at least one build tool for Go which supports vendoring without import rewrites. Welcome to gb. Unfortunately gb doesn’t let you use your default commands any more.

If you threw all your old go conventions over board and started to adopt gb, you are probably wondering how to get your tests running on Travis CI again? Well this is very simple. You can basically take your default .travis.yml for go projects and just modify it a little bit:

language: go
go:
  - 1.5

install:
  - go get github.com/constabulary/gb/...
script: gb test -test.v

This tells Travis CI to install gb as part of the build process and to execute the gb test runner instead of the standard Go test runner. And that is it. I hope that is useful for some people.

Thu Aug 27, 2015