Skip to content

Instantly share code, notes, and snippets.

@paddycarver
Created August 10, 2015 23:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paddycarver/8449553225a10a57757d to your computer and use it in GitHub Desktop.
Save paddycarver/8449553225a10a57757d to your computer and use it in GitHub Desktop.
Run `go vet` on all the Go packages in a directory, then run all their tests, writing test coverage reports to `coverage/pkg.path.out`
SUBPACKAGES := $(foreach pkg,$(sort $(dir $(shell find . -type f -name '*.go'))),$(patsubst %/,%,${pkg}))
# run tests with coverage reports.
test:
@${GO} vet ./...
@mkdir -p coverage
@for pkg in ${SUBPACKAGES}; do \
go test $$pkg -v -coverprofile=coverage/$${pkg/\//.}.out; \
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment