Thank you for your interest in contributing to GoQueue! This document provides guidelines and instructions for contributing.
By participating in this project, you agree to maintain a respectful and inclusive environment for everyone.
Before creating bug reports, please check existing issues to avoid duplicates. When creating a bug report, include:
- Clear title and description
- Steps to reproduce the issue
- Expected behavior vs actual behavior
- Code samples if applicable
- Environment details (Go version, OS, backend used)
Enhancement suggestions are welcome! Please provide:
- Clear use case for the feature
- Detailed description of the proposed functionality
- Potential implementation approach (if you have ideas)
- Why this would be useful to other users
- Fork the repository and create your branch from
main - Make your changes following our coding standards
- Add tests for any new functionality
- Update documentation if needed
- Ensure tests pass (
go test ./...) - Submit your pull request
- Go 1.21 or higher
- Redis (for testing Redis backend)
- Git
# Clone your fork
git clone https://github.com/YOUR_USERNAME/goqueue.git
cd goqueue
# Install dependencies
go mod download
# Run tests
go test ./...
# Run examples
go run examples/basic/main.go# Run all tests
go test ./...
# Run with coverage
go test -cover ./...
# Run with race detector
go test -race ./...
# Run specific test
go test -run TestFunctionName ./...For Redis backend tests:
# Start Redis (if not running)
redis-server
# Run Redis tests
go test -v ./... -tags=redis- Follow standard Go conventions and
gofmtformatting - Use
golangci-lintfor linting - Write clear, self-documenting code
- Add comments for exported functions and types
- Keep functions focused and concise
- Use descriptive names for variables and functions
- Follow Go naming conventions (camelCase for unexported, PascalCase for exported)
- Interfaces should describe behavior (e.g.,
Handler,Backend)
- Return errors instead of panicking
- Provide context in error messages
- Use
fmt.Errorfwith%wfor error wrapping
Example:
if err != nil {
return fmt.Errorf("failed to publish message: %w", err)
}- Write table-driven tests where appropriate
- Test both success and failure cases
- Use meaningful test names
- Mock external dependencies
Example test structure:
func TestPublish(t *testing.T) {
tests := []struct {
name string
message QueueMessage
want error
}{
{
name: "valid message",
message: &TestMessage{},
want: nil,
},
// ... more test cases
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// Test implementation
})
}
}To add support for a new queue backend:
- Create a new file (e.g.,
rabbitmq.go) - Implement the
Backendinterface:type Backend interface { Publish(ctx context.Context, queue string, envelope *Envelope) error Subscribe(ctx context.Context, queue string) (<-chan *Envelope, error) Ack(ctx context.Context, messageID string) error Nack(ctx context.Context, messageID string) error Close() error }
- Add configuration options using the functional options pattern
- Write comprehensive tests
- Add example usage in
examples/directory - Update documentation in README.md
- Update README.md for user-facing changes
- Add inline documentation for exported functions
- Include code examples where helpful
- Update CHANGELOG.md with your changes
Write clear, meaningful commit messages:
Add support for RabbitMQ backend
- Implement Backend interface for RabbitMQ
- Add connection pooling and reconnection logic
- Include example usage
- Add unit tests with 90% coverage
Closes #123
Format:
- First line: Brief summary (50 chars or less)
- Body: Detailed explanation (wrap at 72 chars)
- Footer: Reference issues/PRs
- Update documentation for any user-facing changes
- Add/update tests to maintain coverage
- Ensure CI passes before requesting review
- Link related issues in PR description
- Respond to review comments promptly
- Squash commits if requested
Before submitting:
- Code follows project style guidelines
- Tests added/updated and passing
- Documentation updated
- No breaking changes (or documented if unavoidable)
- Commit messages are clear
- Branch is up to date with main
Releases are managed by maintainers:
- Version bump in accordance with Semantic Versioning
- Update CHANGELOG.md
- Create GitHub release with release notes
- Tag release in Git
- Questions? Open a discussion on GitHub
- Bugs? Create an issue with details
- Ideas? Start a discussion or create an enhancement issue
Contributors will be:
- Listed in the project's contributor list
- Mentioned in release notes for significant contributions
- Credited in the CHANGELOG
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to GoQueue! 🎉