Thank you for considering contributing to the PubSub-Go Library! This document outlines the development workflow and guidelines.
This project uses Git-Flow branching model for development.
main # Production-ready code (tagged releases)
└─ develop # Integration branch for next release
├─ feature/* # New features
├─ bugfix/* # Bug fixes
└─ hotfix/* # Critical fixes from main
- main: Production-ready code. Only releases are merged here.
- develop: Active development branch. All features merge here first.
- feature/*: New features. Branch from
develop, merge back todevelop. - bugfix/*: Bug fixes. Branch from
develop, merge back todevelop. - hotfix/*: Critical production fixes. Branch from
main, merge to bothmainanddevelop.
# Create feature branch from develop
git checkout develop
git pull origin develop
git checkout -b feature/my-new-feature
# Work on your feature...
git add .
git commit -m "feat: add my new feature"
# When done, merge back to develop
git checkout develop
git merge --no-ff feature/my-new-feature
git branch -d feature/my-new-feature
git push origin develop# Create bugfix branch from develop
git checkout develop
git pull origin develop
git checkout -b bugfix/fix-issue-123
# Fix the bug...
git add .
git commit -m "fix: resolve issue #123"
# Merge back to develop
git checkout develop
git merge --no-ff bugfix/fix-issue-123
git branch -d bugfix/fix-issue-123
git push origin develop# Create release branch from develop
git checkout develop
git pull origin develop
git checkout -b release/v1.0.0
# Update version numbers, CHANGELOG, etc.
git add .
git commit -m "chore: prepare release v1.0.0"
# Merge to main and tag
git checkout main
git merge --no-ff release/v1.0.0
git tag -a v1.0.0 -m "Release v1.0.0"
# Merge back to develop
git checkout develop
git merge --no-ff release/v1.0.0
# Delete release branch
git branch -d release/v1.0.0
# Push everything
git push origin main develop --tags# Create hotfix branch from main
git checkout main
git pull origin main
git checkout -b hotfix/critical-bug
# Fix the bug...
git add .
git commit -m "fix: critical production bug"
# Merge to main and tag
git checkout main
git merge --no-ff hotfix/critical-bug
git tag -a v1.0.1 -m "Hotfix v1.0.1"
# Merge to develop
git checkout develop
git merge --no-ff hotfix/critical-bug
# Delete hotfix branch
git branch -d hotfix/critical-bug
# Push everything
git push origin main develop --tagsFollow Conventional Commits specification:
<type>(<scope>): <description>
[optional body]
[optional footer]
- feat: New feature
- fix: Bug fix
- docs: Documentation changes
- style: Code style changes (formatting, etc.)
- refactor: Code refactoring
- test: Adding or updating tests
- chore: Maintenance tasks (build, dependencies, etc.)
- perf: Performance improvements
feat: add HTTP webhook delivery support
fix: correct retry delay calculation in exponential backoff
docs: update README with DLQ examples
refactor: simplify queue worker batch processing
test: add tests for Dead Letter Queue operations
chore: update golangci-lint configuration-
Format code:
make fmt
-
Run linter:
make lint
-
Run tests:
make test -
All-in-one:
make pre-commit
- Code is formatted (
make fmt) - Linter passes (
make lint) - All tests pass (
make test) - New code has tests (minimum 90% coverage, current: 95.9%)
- Documentation updated (if applicable)
- Commit messages follow conventions
- No sensitive data (credentials, tokens, etc.)
- Go 1.25 or later
- golangci-lint
- MySQL, PostgreSQL, or SQLite (for testing)
# Install golangci-lint
make install-lint# Run all tests
make test
# Run with coverage
make test-coverage
# Run with race detector
make test-race
# Run benchmarks
make benchmark# Run linter
make lint
# Save linter report
make lint-reportpubsub/
├── .golangci.yml # Linter configuration
├── .codecov.yml # Coverage configuration
├── Makefile # Development commands
├── cmd/ # Standalone server
│ └── pubsub-server/ # REST API service
├── adapters/ # Repository implementations
│ └── relica/ # Relica query builder adapters
├── model/ # Domain models (DDD)
├── retry/ # Retry strategy
├── migrations/ # Embedded database migrations
├── examples/ # Usage examples
├── publisher.go # Message publishing
├── queue_worker.go # Background worker
├── subscription_manager.go # Subscription lifecycle
└── README.md # Main documentation
- Check if issue exists, if not create one
- Discuss approach in the issue
- Create feature branch from
develop - Implement feature with tests
- Update documentation
- Run quality checks (
make pre-commit) - Create pull request to
develop - Wait for code review
- Address feedback
- Merge when approved
- Follow Go conventions and idioms
- Write self-documenting code
- Add comments for complex logic
- Keep functions small and focused
- Use meaningful variable names
- Public types/functions:
PascalCase(e.g.,ReadSuperblock) - Private types/functions:
camelCase(e.g.,readSignature) - Constants:
PascalCasewith context prefix (e.g.,Version0) - Test functions:
Test*(e.g.,TestReadSuperblock)
- Always check and handle errors
- Use error wrapping with
fmt.Errorf("context: %w", err) - Never ignore errors
- Validate inputs
- Use custom error types from
errors.go
- Use
testify/requirefor assertions - Test both success and error cases
- Use table-driven tests when appropriate
- Mock external dependencies
- Check existing issues and discussions
- Read documentation in
docs/ - Review architecture documentation in
docs/architecture/ - Ask questions in GitHub Issues
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to the PubSub-Go Library! 🎉