CircleCI with Golang and it’s modules

Henrik Hauge Bjørnskov
1 min readSep 7, 2019

Recently I have rediscovered my love for Golang. A language that I used to develop in professionally as a consultant.

Since that time the landscape have changed. New tools have arrived on the scene and Go finally have a modules system.

Getting those two to play nicely on CircleCI wasn’t a quick and easy thing for me to do. So I hope by sharing my raw config it can help others.

So what the config is doing is the default CircleCI stuff, like checking out the code. But look at the cache entries. They have been updated to match the new Golang modules cache path. Also it will use go.sum as its cache path. That way it will only be updated if go.sum is updated.

The second thing it does is running the test runner. CircleCI have builtin support for gotestsum. It is also maintained by one (or more) or their engineers.

By using gotestsum we can have a nice resume of our testrun. And we can reference back to the tests after we reload the page. CircleCI will not save the console output on reloads (which is super weird).

That is all. Maybe it helps someone. Maybe it dosen’t.

--

--

Henrik Hauge Bjørnskov

I build stuff at Relatel A/S, vivid traveller and gear junkie.