In my project, there are hundred packages. So where I run:
$(foreach i,$(TEST_PKGS),go test $(i) -test.short -v)
it will take almost a hour.
If I run: go test $(TEST_PKGS)
, it will cost a large memory.
How to handle it this problem?
In my project, there are hundred packages. So where I run:
$(foreach i,$(TEST_PKGS),go test $(i) -test.short -v)
it will take almost a hour.
If I run: go test $(TEST_PKGS)
, it will cost a large memory.
How to handle it this problem?
You can test all packages in the current directory and all subdirectories with ./...
.
From the documentation:
To make common patterns more convenient, there are two special cases. First, /... at the end of the pattern can match an empty string, so that net/... matches both net and packages in its subdirectories, like net/http.
Second, any slash-separated pattern element containing a wildcard never participates in a match of the "vendor" element in the path of a vendored package, so that ./... does not match packages in subdirectories of ./vendor or ./mycode/vendor, but ./vendor/... and ./mycode/vendor/... do.
Note, however, that a directory named vendor that itself contains code is not a vendored package: cmd/vendor would be a command named vendor, and the pattern cmd/... matches it. See golang.org/s/go15vendor for more about vendoring.