Thank you for considering contributing to Throttlex! Your contributions are highly appreciated and help improve this project for everyone.
- Getting Started
- Setting Up the Development Environment
- Code Contribution Guidelines
- Running Tests
- Submitting Changes
- Issue Reporting
- Code of Conduct
- License
Click the Fork button at the top right of the repository page to create your own copy of the repository.
Clone your forked repository to your local machine:
git clone https://github.com/yourusername/throttlex.git
cd throttlex
Replace yourusername
with your GitHub username.
Set the original repository as the upstream remote:
git remote add upstream https://github.com/neelp03/throttlex.git
This allows you to keep your fork up-to-date with the latest changes.
-
Go: Ensure you have Go version 1.21.x or later installed. Download it from golang.org.
-
Git: Install Git and configure it with your user name and email.
-
Redis: If you plan to work on features involving Redis, install Redis locally or run it via Docker.
Navigate to the project directory and download the module dependencies:
go mod download
-
Follow Go Conventions: Adhere to the standard Go coding conventions. Refer to Effective Go for guidance.
-
Comment Your Code: Document all exported functions, types, and packages with clear comments.
-
Write Idiomatic Go: Use idiomatic Go patterns and best practices.
-
Code Formatting: Use
gofmt -s
to format your code.gofmt -s -w .
-
Linting: Use
golangci-lint
to check for code issues.golangci-lint run
-
Editor Configuration: Configure your editor or IDE to format code on save and highlight linting issues.
-
Use Clear Messages: Write concise and descriptive commit messages.
-
Commit Structure:
Subject: Brief description of the change (max 50 characters) Optional detailed explanation, wrapping at 72 characters.
-
Example:
Add sliding window rate limiter Implemented a new sliding window rate limiter to provide smoother rate limiting over time windows.
Run unit tests with:
go test -race -v ./...
Integration tests may require external services like Redis.
-
Start Redis: Ensure Redis is running locally on
localhost:6379
. You can use Docker:docker run -p 6379:6379 -d redis:6.2
-
Run Integration Tests:
go test -tags=integration -race -v ./...
-
Environment Variables: If Redis is on a different host or port, set
REDIS_ADDR
:REDIS_ADDR=your_redis_host:6379 go test -tags=integration -race -v ./...
-
Sync with Upstream:
git checkout main git fetch upstream git merge upstream/main
-
Create a Branch:
git checkout -b feature/your-feature-name
-
Make Changes: Implement your feature or bug fix, and ensure code is well-documented.
-
Run Tests: Verify that all tests pass.
go test -race -v ./...
-
Commit Changes:
git add . git commit -m "Describe your changes"
-
Push to Your Fork:
git push origin feature/your-feature-name
-
Open a Pull Request:
- Navigate to your fork on GitHub.
- Click on New pull request.
- Provide a clear title and description.
- Reference any related issues (e.g.,
Closes #123
).
If you encounter a bug or have a feature request, please open an issue on the GitHub repository.
-
Search Existing Issues: Before opening a new issue, please check if it has already been reported.
-
Provide Detailed Information: Include steps to reproduce, expected vs. actual behavior, and any relevant logs or screenshots.
We are committed to fostering an open and welcoming environment. Please read and adhere to our Code of Conduct.
By contributing to Throttlex, you agree that your contributions will be licensed under the Apache 2.0 License.
Thank you for contributing to Throttlex!