Thank you for your interest in contributing to GORM Cache Plugin! This document explains how you can contribute to the project.
- Go 1.21 or higher
- Git
- Redis (optional, for Redis adapter tests)
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/gorm-cache.git
cd gorm-cache- Install dependencies:
go mod download- Create a new branch:
git checkout -b feature/amazing-feature- Make your changes
- Add tests
- Run tests:
go test -v ./...- Commit:
git commit -m "feat: add amazing feature"- Push:
git push origin feature/amazing-feature- Open a Pull Request
We use Conventional Commits format:
feat:- New featurefix:- Bug fixdocs:- Documentation changetest:- Add or fix testsrefactor:- Code refactoringperf:- Performance improvementchore:- Other changes
Examples:
feat: add support for custom cache key prefix
fix: resolve race condition in memory adapter
docs: update README with new examples
test: add tests for redis adapter
go test -v ./...go test -cover ./...go test -race ./...- Code formatted with
gofmt - No linter warnings from
golint - Meaningful variable and function names
- Descriptive comments
- Test coverage above 80%
# Format code
go fmt ./...
# Vet check
go vet ./...To add a new cache adapter:
- Implement the
Adapterinterface - Write tests for the adapter
- Add example to README
- Add usage example to
examples/directory
Example structure:
type MyAdapter struct {
// fields
}
func NewMyAdapter(config MyAdapterConfig) *MyAdapter {
// implementation
}
func (a *MyAdapter) Get(ctx context.Context, key string) ([]byte, error) {
// implementation
}
// ... other methods- Add GoDoc comments for public functions and types
- Keep README up to date
- Add examples for new features
- Note your changes in CHANGELOG (if exists)
- Ensure your fork is up to date
- Open a PR describing your changes
- Make sure all tests pass
- Respond to feedback during review
- Make necessary changes
- Tests added and passing
- Code formatted (
go fmt) - Documentation updated
- Examples added (if needed)
- CHANGELOG updated (for major changes)
For questions:
- Use GitHub Issues
- Provide detailed description
- Include code examples when possible
- Share error messages
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to GORM Cache Plugin! 🙏