The test package for package foo should be named foo_test.
Note that this forces tests to only test exported behavior. This is a good thing, because it tests the API as clients see it, and is much more resilient to implementation changes.
A workaround to test unexported behavior is to create export_test.go to provide an exported identifier that will only be visible to tests.
The test package for package
foo
should be namedfoo_test
.Note that this forces tests to only test exported behavior. This is a good thing, because it tests the API as clients see it, and is much more resilient to implementation changes.
A workaround to test unexported behavior is to create
export_test.go
to provide an exported identifier that will only be visible to tests.