We are using Task as our task runner, to install Task run the command below:
go install github.com/go-task/task/v3/cmd/task@v3.40.1After installing Task, you can set up the project with:
# installs Air and Swag CLI and also sets up Git hooks
task setupThe setup command will install Air hot reload. You can read more about it at its GitHub.
The setup command will set up pre-commit git hooks that:
- Format all Go files
- Run go vet for potential errors
- Run all tests in the changed directories
- Prevent committing unwanted files (.exe, .test, .out, .log, .env)
You can run all tests using the command below:
task test -- <TEST_PATH>- The
--separator is required before passing arguments TEST_PATHis the path to the test file or package you want to test (e.g../pkg/richerroror./pkg/...)
To run tests with coverage profile, run the following:
task test:cover -- <TEST_PATH>- Add logger
- Create Docker image
- Envelope panic recovered errors
- Add swagger
- Add Auth service