I’m having a hard time figuring out why a function declared and defined in a certain _test.go like this:
file1_test.go:
//go:build foo_test_1
package foo
import (
"testing"
"reflect"
)
func generateNode() *Node {
return &Node{}
}
// ... rest of file are just test funcs
inside another _test.go file:
//go:build foo_test_2
package foo
import "testing"
func TestXXX(t *testing.T) {
n := generateNode{}
// ... rest of the test logic
}
I’m using different build tags to filter tests to be executed.
Does the problem happen because I’m missing a concept for go builds in testing despite having the 2 test files in a single package?
Tree of the package:
.
├── file1.go
├── file1_test.go
├── file2.go
└── file2_test.go
0 directories, 5 files
2