Thank you for your interest in contributing to Barnacle! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Setup
- Making Changes
- Testing
- Submitting Changes
- Style Guidelines
- Reporting Issues
By participating in this project, you agree to maintain a respectful and inclusive environment. Be considerate of others and focus on constructive collaboration.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/barnacle.git cd barnacle - Add the upstream repository as a remote:
git remote add upstream https://github.com/pdylanross/barnacle.git
- Go 1.25.3 or later
- Docker and Docker Compose
- Make
Install the required development tools:
make toolsThis installs:
swag- Swagger documentation generatorgoimports- Import formattinggolangci-lint- Linter
Start the local development dependencies (Redis):
make local-upTo stop the dependencies:
make local-downmake buildmake run serve-
Create a new branch for your changes:
git checkout -b feature/your-feature-name
-
Make your changes, following the style guidelines
-
Run formatting:
make fmt
-
Run the linter:
make lint
-
Run tests:
make test -
Commit your changes with a descriptive commit message
Run unit tests with race detection:
make testFor e2e tests, first start the local cluster:
make local-cluster-build
make local-cluster-upThen run the e2e tests:
make e2eClean up after testing:
make local-cluster-down- Place unit tests in
*_test.gofiles alongside the code they test - Place e2e tests in
test/e2e/ - Use table-driven tests where appropriate
- Use
github.com/stretchr/testifyfor assertions - Use
github.com/alicebob/miniredis/v2for Redis mocking in unit tests
- Ensure all tests pass and the linter reports no issues
- Update documentation if you're changing behavior
- Push your branch to your fork:
git push origin feature/your-feature-name
- Open a pull request against the
mainbranch - Fill out the pull request template with relevant information
- Wait for review and address any feedback
Write clear, concise commit messages that explain the "why" behind changes:
- Use the imperative mood ("Add feature" not "Added feature")
- Keep the first line under 72 characters
- Reference issues when applicable (e.g., "Fix #123")
Good examples:
Add manifest cache TTL configuration
Allow users to configure how long manifests are cached before
revalidation. Defaults to 5 minutes for tags.
Fixes #42
Fix race condition in blob streaming
The blob reader could be closed while still in use during
concurrent requests. Add mutex to protect reader lifecycle.
- Follow standard Go conventions and idioms
- Run
make fmtbefore committing (usesgoimportsandgofmt -s) - Run
make lintto check for issues (usesgolangci-lint)
- Add godoc comments to all exported functions, types, and packages
- Keep comments concise and focused on "why" rather than "what"
- Update README.md if adding user-facing features
- Follow OCI Distribution Specification for registry endpoints
- Use proper HTTP status codes and error responses
- Add Swagger annotations for new API endpoints:
make swagger
When reporting bugs, please include:
- Go version (
go version) - Operating system and architecture
- Steps to reproduce the issue
- Expected behavior
- Actual behavior
- Relevant logs or error messages
For feature requests, please describe:
- The problem you're trying to solve
- Your proposed solution
- Any alternatives you've considered
We especially welcome contributions in these areas:
- Performance testing at scale
- Additional upstream registry integrations
- Metrics and Grafana dashboards
- Documentation improvements
- Bug reports and fixes
If you have questions, feel free to:
- Open an issue for discussion
- Check existing issues for similar topics
Thank you for contributing to Barnacle!