Getting a `--version` flag for Cobra CLIs in Go, built with GoReleaser

Update 2023-05-27: If you're looking for an option that works with GoReleaser and go installs, check out my more recent post Getting a --version flag for Cobra CLIs in Go. As part of working on my new Go CLI dmd, I wanted to implement a --version flag to be able to check what ver...

Interfaces 101 : Determine LOC with io.Writer Ep. 5

Introduction In episode 4, Miki defined an enumerated type that satisfied Go’s fmt.Stringer interface. By implementing the fmt.Stringer interface, Miki can specify how his enumerators were printed within a formatted string and in this case, he expected the values to be displaye...

From Go on EC2 to Fly.io: +fun, −$9/mo

How I switched hosting my Go-based side projects from Amazon EC2 to Fly.io, significantly simplified deployment, and saved a bit of cash while I was at it.

Cross-compiling a CGO project using Goreleaser

While working on creating a new Go CLI dmd, I wanted to set up Gorelaser to make builds much simpler, as I wanted to be able to use this with both my Linux machine and my work Mac. I thought I had it working until I realised that I was using a library that required CGO to be buil...

Opting In to Transparent Telemetry

Updating the transparent telemetry design to be opt-in. (Transparent Telemetry, Part 4)

From packages to commands

In Part 2 of a series about writing packages, not programs, we see how to test a package that prints to the terminal, and use the result to build our “hello, world” CLI tool.

Interfaces 101 : Go's Logging Interface Ep. 4

Introduction In episode 3, Miki implemented a type that satisfied Go’s error interface. The odd thing about his type was it would be considered not-nil although no value was set for it. To get a better understanding of the situation, Miki gives a brief explanation of how Go det...

Introducing `dmd`, a command-line tool for Dependency Management Data (DMD)

I've been doing a lot of work recently around the dependency data of various projects, which stems from a post and idea of mine from a while ago about monetising the supply chain. Separate to that lofty goal - especially as there are some tools like socket.dev and StackAid workin...

What’s new in Go 1.20? Podcast

I was on episode 267 of the Go Time podcast, talking about What’s New in Go 1.20. Check it out!

Watermill v1.2 released

After almost three years since the last stable release, Watermill v1.2 is finally out! If you’re new here, Watermill is our open-source library for building event-driven applications in Go, the easy way. A lot has happened since v1.1. We’ve been running Watermill on p...