My Go project code structure looks something like this.
project
|
+-- x_test.go
|
+-- sub-directory
| |
| +-- y_test.go
x_test.go has some struct and methods that are used only for test purposes.
These struct and methods are un-accessible in y_test.go. Is there a way test files can be imported in sub-directories? I cannot move the file x_test.go to the sub-directory as it makes use of some interfaces defined in the root level directory.
The file y_test.go cannot be put at the root level as it is using some instances defined in sub-directory, and this would cause a cyclic dependency.
Is there a way I can make the methods and struct defined in x_test.go visible to y_test.go?
PS : Everything works fine if I don't treat x_test.go as a test file. i.e, I rename it to just x.go
Aucun commentaire:
Enregistrer un commentaire