Go Development Tools for Testing and Hot Reloading

James Wickett
Signal Sciences Labs
4 min readSep 12, 2017

Those new to the Go language (sometimes called Golang) often are excited about the simplicity, speed and portability of the language. Go also has a wonderful ecosystem of tooling for testing and helpers for working on web applications and APIs. In this post, we look at a few.

Keep Go development moving with hot-reloading using Fresh. Photo by Anthony Legrand on Unsplash

Along with Ernest Mueller I have recorded a few courses over at Lynda.com and LinkedIn Learning on DevOps, Continuous Delivery and Infrastructure as Code. In those courses Ernest and I take an approach of covering theory and philosophy and then follow it up with real world experiences, code samples, and tooling. Our latest course DevOps Foundations: Continuous Delivery/Continuous Integration just shipped this week and we are really hoping that the course helps people get started or advance their CI/CD efforts.

In the course, I covered some tools to do unit testing and I wanted to share those with you here as well. We are going to look at 2 tools I particularly like for Go web development.

1. GoConvey

“GoConvey is awesome Go testing” as written in the readme in the project’s github repo. From my experience it is! There is a lot to love here with GoConvey. Let’s start with this lovely UI.

Screencap from Unit Testing chapter from our CI/CD course on Lynda.com

GoConvey’s UI is lovely, with green, yellow, red and gray status bars taking the main real estate to let you know when something is wrong. Additionally I love being able to have a single dashboard to see code coverage, statistics, and a package-by-package breakdown of my project.

I often turn GoConvey on as I work on a project, and then I just forget about it. That is until I write a something new or update a test. In fact every time I save a file in my project, I get a nifty notification to my desktop letting me know whether what I just did passed or failed. It seems like GoConvey has special hooks for Sublime, however I can’t speak to that as I just use vim. Old habits die hard.

HTML5 desktop notifications! source: http://goconvey.co/

Some people get turned off of GoConvey because they think that you have to use to use the package’s testing DSL in order to get the benefit of the tool. That would mean refactoring a bunch of tests and that wouldn’t be too much fun. I am happy to report that is not the case at all, the tool works natively with go test.

Check out more on GoConvey at http://goconvey.co/

2. Fresh

You were wondering about the apricots weren’t you? Well, fear no more.

Fresh! Photo by Brigitte Tohm on Unsplash

Have you ever been working on a project where you made a change in the code but for some reason are not able to see the change reflected in the web application? Maybe it was just a color change or new text or maybe an update to the API. Why doesn’t it show up? You dig around the documentation, check the library you are using, you fumble around to check the tests. Only after 10 minutes of this you realize you forgot to restart the application: doh!

This is where Fresh comes in. Fresh does hot-reloading of config on changes. What does this mean? This means that when you write a new feature or change a button or even update a template that the web application you are working on gets restarted automatically. No more remembering to restart, it just does it for you.

To get started with Fresh, check out https://github.com/pilu/fresh.

https://info.signalsciences.com/book

--

--

James Wickett
Signal Sciences Labs

Head of Research at Signal Sciences, creator of gauntlt, and author of DevOps courses at Lynda.com / LinkedIn Learning