Advent2019

Go: Testing database migrations with Drone CI

Since we can now list our database migrations, the next logical step is testing them out on a real database. For that we still need to implement our Run function. Based on what we have in Print(), we only need to update the migrate() function.

Read more

Go: Scaffolding database migrations

As we prepared the database migration files and embedded them into the db package, we are now left to implement the details required to process these migrations. Let’s start with extending the FS type, to actually provide functionality for reading them.

Read more

Bash: Embedding files into Go

There’s always that chance that your Go app/service will need to bundle some files in order to fulfill some requirement. A common case of that is bundling SQL migrations into an app. SQL migrations are a set of SQL queries that need to run to set up a clean database, or to change database schema over the course of the applications lifetime.

Read more

Bash: Poor mans code generation

When it comes to generating code, I often find that the simplest code generation only needs variable replacement. There’s a cli utility that already facilitates this with environment variables, named envsubst, part of the gettext suite of tools.

Read more

Make: Dynamic Makefile targets

A common pattern which we want to support when building our services is to build everything under rpc/{service}/{service}.proto as well as cmd/* and other locations which may be manually written or generated with various tools.

Read more