Reading List

The most recent articles from a list of feeds I subscribe to.

if got, want: A Simple Way to Write Better Go Tests

There’s an excellent Go testing pattern that too few people know. I can teach it to you in 30 seconds.

Instead of writing Go tests like this:

// The common, unrefined way.
username := GetUser()
if username != "dummyUser" {
 t.Errorf("unexpected username: got %s, want: %s", username, "dummyUser")
}

Write your tests like this, beginning each assertion with if got, want :=:

// The underused, elegant way.
if got, want := GetUser(), "dummyUser"; got != want {
 t.Errorf("username=%s, want=%s", got, want)
}

The if got, want :=: pattern works even better in table-driven tests. Here’s an example from my library for parsing social media handles:

The Case for Open Borders by John Washington

If you’re a liberal who’s interested in becoming a radical progressive, this is a good book for you. If you’re anyone else, you’re probably not the target audience.

Paternity Leave: Month 4

Highlights

  • I found ways to procrastinate writing my book.
  • I had fun fuzz testing open-source projects.
  • I picked out components for a new high-end desktop computer for software development.

Goal grades

At the start of each month, I declare what I’d like to accomplish. Here’s how I did against those goals:

Enjoy family time

  • Result: Continued to enjoy family time.
  • Grade: A

During my self-managed paternity leave, I’m continuing to enjoy the balance between my family time and my time working on personal and professional projects.

My Feedback about Hello Base

The cryptocurrency language barrier

There’s an unforunate language barrier among technologists right now.

Cryptocurrency enthusiasts are excited about the ecosystem and what’s going on in crypto-world right now. They’re trying to bring new people in, but they’re often so entrenched in their crypto bubble that they struggle to explain any crypto stuff to non-crypto people.

I feel like I’m a good candidate to bridge the language gap, as I understand the fundamentals of cryptocurrency but I haven’t been following any crypto stuff closely for about seven years.

Run a Simple Go Web Service on NixOS

I have a few toy utility apps that I run 24/7 on cloud infrastructure. One example is PicoShare, a simple web app that makes it easy for me to share files with friends and teammates.

There are several convenience apps I would run if it were easy to run them constantly. But there’s enough friction to running even a simple app 24/7 that I don’t do it.

In the past, I’ve tried running toy apps on my home server. I’ve set up cron jobs and systemd services, but inevitably something breaks, and I get tired of fixing it and just let the service die.