Interfaces 101 : Interface Type Assertion Ep. 6

Introduction In episode 5, Miki wrote a function that counted the number of lines in a file with interfaces. The first thing his function did was to open a file with Go’s os.Open function. Miki chose this method because the variable returned by said function implements the io.R...

An unexciting idea: Code changes have context

Announcing GoReleaser v1.16 — the late February release

The February release got a little late… better later than even later, I guess! 😄 goreleaser healthcheck It is packed with some juicy features and tons of bug fixes and quality-of-life improvements. Let’s take a look: Highlights On GoReleaser Pro y...

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...