Ensure git uses the custom directory for git hooks so the pre-commit and commit-msg linting hooks kick in.
git config core.hooksPath .githooksThere are npm dependencies that provide tools that are used in git hooks for commit linting.
Install dependencies from the root directory by simply running:
yarnRun all tests with integration tests, race detection and coverage:
bash scripts/run-tests.sh --integrationThis will:
- Run all tests with race detection enabled
- Include integration tests
- Generate
coverage.txtwith coverage data - Generate
coverage.htmlfor visual coverage inspection (on dev machines)
To run unit tests only (without integration tests):
bash scripts/run-tests.shTo run tests for a specific package:
go test -v ./styles/...
go test -v ./config/...stateio's tests, unit tests included, need the integration stack, so go test ./... fails
there without it; use bash scripts/run-tests.sh --integration for that package.
The integration run needs docker, the aws CLI, jq and curl, and test credentials for
LocalStack, as CI sets them:
AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test bash scripts/run-tests.sh --integrationRun static analysis and vet checks:
bash scripts/lint.shThis runs:
staticcheck- static analysis tool for Gogo vet- reports suspicious constructs
Install staticcheck if not already installed:
go install honnef.co/go/tools/cmd/staticcheck@latest# Run staticcheck on all packages
staticcheck ./...
# Run go vet on all packages
go vet ./...
# Format code
go fmt ./...