测试golang文件夹结构

测试golang文件夹结构,go,Go,我的文件夹结构如下 src/ github.com/ hello/ hello.go hello_test.go integers/ integers.go integers_test.go hello.go/hello_test.go

我的文件夹结构如下

src/
   github.com/
              hello/
                   hello.go
                   hello_test.go 
                   integers/
                            integers.go
                            integers_test.go
hello.go/hello_test.go属于主程序包 integers.go/integers\u test.go属于包整数

从文件夹hello的根目录运行go测试时,它只运行hello\u test.go。如何让它递归地运行所有测试。这是在各自包中构造测试的正确方法吗


谢谢

创建一个make文件怎么样?将来,如果您扩展项目并拥有更多的测试文件,那么您可以通过运行maketest一次测试所有这些文件。
这会很有帮助。

试试go test。/…效果不错!!任何我能读到为什么的地方?:/:也允许使用相对模式,如go测试。/。。。测试所有子目录。有关模式语法的详细信息,请参阅“go help packages”。go help test解释了这一点,以及其他内容。当您可以运行go test时,这是不必要的额外复杂性和依赖性。/。。。不管您有多少测试文件/包。