Skip to content
Turtle

Improve your developer workflow in Go

Golang, CI1 min read

I decided to work on improving my workflow in Go. Some of the things I had in mind going into this project where:

  • Building and testing on each PR and on the master branch
  • Linting on PRs
  • Auto formatting on PRs
  • Deploy previews on PRs

I created a repo go-ci with a simple test server. Next I started browsing the GitHub Marketplace for existing actions/apps I could use.

Build, Test, Benchmark...Oh My

This required a few actions. I used one separate action for building and testing. Another action I thought was cool allowed me to run a benchmark test and upload the results to GitHub pages.

Lint Rollers

I used an existing action for linting which under the hood used golangci-lint. This was nice because it supported multiple linters and would catch more issues.

Auto Format

For formatting, I saw a few actions which would fail a build for unformatted code. However, I really wanted to auto format the Go code on each PR since this was a repetitive task. I looked around and saw a few existing actions for JS projects and decided to create a similar one. I created my own action using gofumpt underneath and published it to the Marketplace.

Sneak Peak Previews

I wanted each PR to have a deployable app. The quickest way for me was to setup a Heroku pipeline and enable Review apps. While this works, there is probably a better way of doing this.

And that's it.


Just do it - Shia Surprise