In this second part of the series on building a Go Testing Module, the author delves into the implementation phase after laying out the project requirements in the previous post.
To tackle the chicken-and-egg problem of writing clean tests without the assertion library in place, the author introduces small internal packages - core and affirm - to bootstrap the project.
The core package, comprising functions like IsNil, WillPanic, and Same, forms the foundation of the module and addresses key testing needs such as nil checking, handling panics, and comparing memory addresses.
The affirm package, a precursor to the assert package, provides basic assertions with clear log messages for common cases like equality checks, nil checks, and panics.
While affirm serves as a starting point with minimal functionality, core handles heavy lifting tasks to ensure readable testing.
This strategic approach allows for progress in building out the full testing module, with future plans including assert package development, mocking support, and golden files.
The author invites readers to follow the Go Testing Module's development on GitHub, where feedback and contributions are welcomed.
The next post will focus on testing the affirm package thoroughly to ensure it serves as a strong foundation for further expansion.