When I have module and its test in the same directory it works ok.
- module1.go
- module1_test.go
But when number of files and test files grows it is hard to navigate through code.
Is it possible to place go tests to subfolder for cleaner code structure? When I try to do it I got namespace error.
I placed file module1_test.go
to folder ./test
- module1.go
- test/module1_test.go
Now I got error on testing:
test/module1_test.go:8: undefined: someFunc
My module1.go
code:
package package1
func someFunc() {
}
My module1_test.go
code:
package package1
import (
"testing"
)
func TestsomeFunc(t *testing.T) {
someFunc()
}