Pop quiz: pass or fail?

April 20, 2026

I'm launching a new live course: **Idiomatic Testing in Go**. The course begins May 5. Early-bird pricing is in effect until April 28.
  • Why Go avoids assert libraries
  • Better alternatives to mocks
  • Make writing tests fun!

Today’s post is a taste of what we’ll cover.

See pricing & reserve →


Pop quiz. Does this testify assertion pass or fail?

	var x []int
	y := []int{}
	require.Equal(t, x, y)

If you’re like me, you have no idea. Arguments for both seem reasonable. And the docs don’t help.

Is the learning curve worth it?

Assertion libraries are popular in Go, and for a solid reason: they make tests shorter. But in exchange, you’re signing up for some hefty costs, which are often overlooked. A few, from the official Go wiki:

  • They require developers to learn a whole new sub-language just to read or write tests
  • Most assertions abort a test early, omitting potentially useful information from the output
  • They hurt expressiveness, both in communicating what is being asserted, and in how you present failures
  • They make it easy to write imprecise tests
  • They duplicate features already found in the language, such as evaluation, comparison, and often more

And a few more reasons of my own:

  • Many assertion libraries are internally inconsistent (testify is one such example)
  • They require a combinatoric explosion of functions to express slight variants on certain checks, which are much easier expressed using first-class language features such as ! or &&

Then why is testify so popular?

Continue reading on boldlygo.tech


Share this

Direct to your inbox, daily. I respect your privacy .

Unsure? Browse the archive .

Get daily content like this in your inbox!

Subscribe