Skip to content

Instantly share code, notes, and snippets.

@rafiramadhana
Last active February 16, 2021 16:18
Show Gist options
  • Save rafiramadhana/53581f4dac9605a30690843cb27f30c1 to your computer and use it in GitHub Desktop.
Save rafiramadhana/53581f4dac9605a30690843cb27f30c1 to your computer and use it in GitHub Desktop.
Unit test coverage check in Go
LOAD_TEST_ENV=env $$(cat .env.testing | xargs)
GOTEST=go test
GOTEST_PATH=./internal/usecase/...
GOCOVER=go tool cover
coverage:
$(LOAD_TEST_ENV) \
$(GOTEST) -tags=unit -coverprofile=cover.out $(GOTEST_PATH)
$(GOCOVER) -html=cover.out && unlink cover.out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment