I believe that test-driven development (TDD) makes me write better code, so I wanted to start with tests.
Testing and assertions
Fortunately, the Go Testing Bible (and the free YouTube channel) pointed me in the direction I needed with Getting Started with Testify. Testify is a testing library that includes assertions like the ones I know.
On the other hand, I could not find a built-in file watcher that would re-run tests when I modified source or test files.
--watch flag is common in other test runners. I don’t know if my search-engine skills are bad or if most Gophers roll their own solutions to this program, but I found little information about this topic on the web.
I solved the file-watching problem with Go Watch.
It’s a tiny package.
I installed it with
go install github.com/mitranim/gow@latest.
To use it, I replaced
go test with
gow test (“go watch”).