Ricko M
Ricko M

Reputation: 1784

Testing golang folder structure

My folders are structured as follows:

src/
   github.com/
              hello/
                   hello.go
                   hello_test.go 
                   integers/
                            integers.go
                            integers_test.go

hello.go/hello_test.go belong to package main
integers.go/integers_test.go belong to package integers

When runing go test from the root of folder hello, it only runs hello_test.go. How can I get it to run all tests recursively. Is this the right way to structure tests inside their respective packages?

Upvotes: 1

Views: 1389

Answers (1)

jkasper
jkasper

Reputation: 246

How about having a make file? In the future if you expand your project and have more test files then you can test all of them at once by just running make test. This link would be helpful.

Upvotes: 2

Related Questions