Tech and travel

Category: Tech

Tracerbullet

2024-08-14

One feature I’ve missed in logging packages is a way to turn on debug logging for one HTTP request at a time by use of a HTTP header. If this is passed on to any other HTTP services called, like in a micro-services architecture, we can get a cheap trace. The other requests will still log at the default (non-debug) level. I’ve written an extension for slog called tracerbullet that does exactly that.

Errgroup

2019-02-27

The errgroup package provides a way to run a group of goroutines. It’s similar to the well known WaitGroup but allows for easy and correct cancellation.

Adding a Go interface to help with unit testing

2018-08-15

Go interfaces apply automatically to any types that implement all the methods. This means you can define your interfaces near the code that uses them. They also provide an easy way of stubbing out code for use in unit tests. Here’s an example.

Go and vim

2014-11-11

The default vim go language syntax file uses a tabstop of 8, which is a bit excessive.

Resize images on the command line on Mac OS X

2014-08-03

My new camera is very nice, but the default file size is too large for my gallery.

Copyright (c) 2024 Michel Hollands