Testing shell commands in Go

A standard way of running shell commands in Go is via exec.Command. However, calling this function directly within your business logic makes the code hard to test. This post demonstrates an approach I developed when I had to adapt my code for running shell commands both locally and remote over SSH, while also keeping it testable. TL;DR: extract exec.Command into an interface and create a mock implementation for testing. Implement it for your SSH client too, if needed.

Byobu, a simple terminal multiplexer

I am not a proponent of highly customized development environments. During the years, I’ve tried employing various “advanced” tools and tricks in my workflow: zsh, all sorts of terminals, shortcuts, aliases, and so on. Most of them didn’t stick. In most cases, I’m not interested enough to change the ways and habits for something that is supposed to marginally improve my everyday work, doesn’t come by default, and requires extra configuration.

But it works on my machine

It is mostly acknowledged that developers should be responsible for their code on every stage of its lifecycle. Despite that, some think that having a code work on their machine is enough to consider a job to be done, or that fixing and preventing issues in production is none of their business. The others are simply unaware of the complexities of real world and of the differences between a production environment and their local setup. This post is mostly for and about the latter.

Make CapsLock useful (again) on Linux and Windows

TL;DR: Use this repository to remap the CapsLock key and move your hands around the keyboard more effectively.

Setting up development environment with docker