If I have different packages and each have a test file (pkg_test.go
) is there a way for me to make sure that they run in a particular order ?
Say pkg1_test.go
gets executed first and then the rest.
I tried using go channels but it seems to hang.
It isn't obvious, considering a go test ./...
triggers test on all packages... but runs in parallel: see "Go: how to run tests for multiple packages?".
go test -p 1
would run the tests sequentially, but not necessarily in the order you would need.
A simple script calling go test
on the packages listed in the right expected order would be easier to do.