Thank you for your interest in contributing to Redis Stream Client Go! This document provides guidelines and information for contributors.
- Go 1.23 or later
- Docker (for running tests with Redis containers)
- Git
-
Fork and Clone
git clone https://github.com/YOUR_USERNAME/redis-stream-client-go.git cd redis-stream-client-go -
Install Dependencies
go mod download
-
Run Tests
go test -v ./... -
Set Environment Variables For testing, you'll need:
export POD_NAME=test-consumer-1 # OR export POD_IP=127.0.0.1
feature/description- New featuresfix/description- Bug fixesdocs/description- Documentation updatesrefactor/description- Code refactoringtest/description- Test improvements
We follow Conventional Commits:
type(scope): description
[optional body]
[optional footer]
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
Examples:
feat(client): add stream recovery timeout configuration
fix(lbs): handle edge case in message claiming
docs(readme): update usage examples
test(integration): add bulk notification tests
- Integration Tests: Located in
test/directory - Unit Tests: Should be created alongside source files (e.g.,
impl/client_test.go) - Benchmarks: Performance tests for critical paths
-
Test Naming: Use descriptive names
func TestRedisStreamClient_ClaimHandlesExpiredStream(t *testing.T) { // Test implementation }
-
Use Testcontainers: For integration tests requiring Redis
redisContainer := setupSuite(t) redisClient := newRedisClient(redisContainer)
-
Table-Driven Tests: For multiple test cases
tests := []struct { name string input string expected string }{ {"case1", "input1", "expected1"}, {"case2", "input2", "expected2"}, }
# Run all tests
go test -v ./...
# Run with coverage
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
# Run specific test
go test -v ./test -run TestLBS
# Run benchmarks
go test -bench=. ./...- Follow Effective Go
- Use
gofmtfor formatting - Follow Go Code Review Comments
-
Error Handling
// Good if err != nil { return fmt.Errorf("failed to claim stream %s: %w", streamName, err) } // Avoid if err != nil { return err }
-
Interface Design
- Keep interfaces small and focused
- Define interfaces where they're used, not where they're implemented
-
Documentation
- All exported functions must have godoc comments
- Include examples for complex functions
// Claim allows a consumer to claim a data stream from another failed consumer. // It should be called when a consumer receives a StreamExpired notification. // // Example: // err := client.Claim(ctx, "session0:1234567890-0") // if err != nil { // slog.Error("Failed to claim stream", "error", err) // } func (r *RecoverableRedisStreamClient) Claim(ctx context.Context, kspNotification string) error {
-
Self Review
- Run
go vet ./... - Run
gofmt -s -w . - Ensure all tests pass
- Check test coverage
- Run
-
Pull Request Checklist
- Tests added/updated for new functionality
- Documentation updated
- Commit messages follow convention
- No breaking changes (or clearly documented)
- Performance impact considered
When creating a PR, make sure to follow the pull request template presented on GitHub to write the description.
When reporting bugs, please include:
-
Environment Information
- Go version
- OS and version
- Redis version
-
Steps to Reproduce
- Minimal code example
- Expected vs actual behavior
- Error messages/logs
-
Additional Context
- Configuration details
- Network setup
- Load characteristics
For new features:
- Use Case: Describe the problem you're trying to solve
- Proposed Solution: Your suggested approach
- Alternatives: Other solutions you've considered
- Breaking Changes: Any compatibility concerns
- Code Comments: Explain complex logic
- README: Keep examples current
- Architecture Docs: System design and flow
- API Docs: Generated from godoc comments
- Use clear, concise language
- Include practical examples
- Keep examples up-to-date with code changes
- Explain the "why" not just the "what"
- Be respectful and inclusive
- Focus on constructive feedback
- Help newcomers learn and contribute
- Assume positive intent
- GitHub Issues: Bug reports and feature requests
- GitHub Discussions: Questions and general discussion
- Code Review: Learning opportunity for everyone
We follow Semantic Versioning:
MAJOR.MINOR.PATCH- Breaking changes increment MAJOR
- New features increment MINOR
- Bug fixes increment PATCH
- Update CHANGELOG.md
- Update version in relevant files
- Create release tag
- Update documentation
- Announce release
- Maintainer: Badari Burli burli.badari@gmail.com
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Thank you for contributing to Redis Stream Client Go! 🎉