Thank you for your interest in contributing!
- Go 1.27 or later
- golangci-lint (CI runs the latest release)
- A PostgreSQL server, only for the
coordination/postgrestests
# Clone the repository
git clone https://github.com/libtnb/cron.git
cd cron
# Build
go build ./...
# Run unit tests with the race detector, as CI does
go test -race ./...
# Run linter
golangci-lint run ./...
# Formatting and vet checks that CI enforces
gofmt -l .
go vet ./...
# Short fuzz runs, as in CI
go test -run=^$ -fuzz=FuzzParser_StandardNeverPanics -fuzztime=30s .
go test -run=^$ -fuzz=FuzzSpecScheduleNext -fuzztime=30s .coordination/redis, coordination/postgres, contrib/prometheus and contrib/otel are separate Go modules that pin a released github.com/libtnb/cron version. To test them against your working copy of the core package, create a temporary workspace as CI does (go.work is ignored by git):
go work init . coordination/redis coordination/postgres contrib/prometheus contrib/otel
(cd coordination/redis && go test -race ./...) # starts an embedded miniredis
(cd contrib/prometheus && go test -race ./...)
(cd contrib/otel && go test -race ./...)
# The PostgreSQL tests need a reachable server
export CRON_PG_TEST_DSN='postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable'
(cd coordination/postgres && go test -race ./...)- Fork the repository
- Create a feature branch:
git checkout -b feat/my-feature - Make your changes
- Add tests for new functionality
- Run
go test -race ./...andgolangci-lint run ./... - Commit with a descriptive message
- Push and open a Pull Request
- Follow Effective Go
- Add doc comments to all exported symbols
- Write table-driven tests that exercise behaviour, not configuration files
- Keep
gofmtclean andgo vetsilent; CI fails on either - Record user-visible API or default changes in
CHANGELOG.mdunder[Unreleased]
Use GitHub Issues. Include:
- Go version (
go version) - OS and architecture
- Steps to reproduce
- Expected vs actual behavior