Which naming rule causes a Go source file to be treated as a test file, compiled only when running
go test, and normally excluded from go build?- aThe package must be declared as
package test. - bThe filename must end with
_test.go.✓ - cThe filename must start with
test_. - dThe file must use a
.testextension instead of.go.
Explanation:
go build ignores any file whose name ends in _test.go; go test compiles those files separately into a test binary. The package name and any filename prefix don't affect this rule.