Go Testing Patterns
Last updated: January 09, 2025
if got, want :=
The if got, want := pattern in Go tests improves clarity by clearly separating actual (got) and expected (want) values.
If you want to read a nice blog explaining this you can check this: if got, want: A Simple Way to Write Better Go Tests · mtlynch.io
Example
func TestAdd(t *testing.T)