My project structure is like this.
packagetest/
main.go
lib.go
In main.go, I have this code.
package m
lib.go should be renamed to main_test.gofunc Test(t *testing.T) {testing should be imported in main_test.go.Test function should have a name that reflects what it is testing, like TestPrinting.Then both go build and go test should work.