Documentation Index
Fetch the complete documentation index at: https://mintlify.com/traefik/traefik/llms.txt
Use this file to discover all available pages before exploring further.
Contribution Guidelines
This guide covers the standards and best practices for contributing code to Traefik. Following these guidelines helps ensure your contributions can be reviewed and merged quickly.Before You Start
Create an Issue First: For enhancements or features, always create an issue before starting work. This allows maintainers to provide design feedback and confirm the feature aligns with project goals.
Check Existing Work
Before starting:- Search existing issues to avoid duplicates
- Comment on issues you’re interested in working on
- Look for the
contributor/wantedtag for priority features - Check Good First Issues if you’re new
Development Workflow
1. Fork and Clone
Fork the repository and clone it locally:2. Create a Branch
Create a feature branch from the latestmaster:
3. Make Changes
Write your code following the standards below.4. Commit Changes
Write clear, descriptive commit messages:Commit Message Best Practices
- Subject line: 50 characters or less, imperative mood (“Add” not “Added”)
- Body: Explain the “why” not the “what”
- Reference issues: Include
Fixes #123orRelates to #456 - Sign commits: Use
git commit -sif required
5. Push Changes
6. Create Pull Request
Open a pull request from your fork totraefik:master.
Code Standards
Go Style
Traefik follows standard Go conventions with additional linting rules:Formatting
- Use
gofumpt(stricter thangofmt) - Run
make fmtbefore committing - Organize imports with
gci
Linting
All code must pass golangci-lint:- govet - Go vet checks
- errcheck - Verify error handling
- gofumpt - Strict formatting
- gci - Import organization
- staticcheck - Advanced static analysis
- gosimple - Simplification suggestions
- ineffassign - Detect ineffectual assignments
- unparam - Unused function parameters
See
.golangci.yml in the repository root for the complete linter configuration.Code Organization
- Package names: Short, lowercase, no underscores
- Function names: Clear and descriptive (prefer
CreateHandleroverCH) - Variable names: Short for small scopes, descriptive for larger scopes
- Interfaces: Name with
-ersuffix when appropriate (Reader,Writer)
Comments
Required Comments
- Exported functions/types: Must have doc comments
- Complex logic: Explain the “why” behind non-obvious code
- TODOs: Use
// TODO: description(but avoid in production code) - Package comments: Document package purpose in
doc.goor main file
Error Handling
- Always check errors:
if err != nil - Use standard library
errorspackage (notgithub.com/pkg/errors) - Wrap errors with context:
fmt.Errorf("failed to load config: %w", err) - Don’t ignore errors (linter will catch this)
Testing
Test Coverage
- Write tests for all new functionality
- Maintain or improve existing coverage
- Include both positive and negative test cases
Test Organization
Running Tests
Dependencies
- Prefer standard library over external dependencies
- Dependencies in
go.modmust reference tags (not commits) - If tag not possible, add a comment explaining why
- Run
make validateto check vendor consistency
Pull Request Guidelines
Before Submitting
Run all validation steps locally:PR Best Practices
Size Matters
Keep PRs Small: Large PRs take longer to review and are more likely to be rejected. Break large changes into multiple smaller PRs when possible.
- Each PR should solve one problem
- If you can extract separate concerns, do it
- Multiple small PRs > one large PR
- Aim for < 400 lines changed when possible
PR Template
Use the PR template and fill it out completely:- Description: What does this PR do?
- Motivation: Why is this change needed?
- Related issues: Link to issues (e.g.,
Fixes #1234) - Type of change: Bug fix, feature, docs, etc.
- Testing: How did you test this?
PR Settings
- Not from organization: Open PR from your personal fork, not organization repo
- Allow edits: Keep “Allow edits from maintainers” checked
- Not a draft: We don’t review drafts (but we answer questions on them)
- Semantic line breaks: Use in documentation (one sentence per line)
PR Review Process
The review process follows these stages:Response Time
- Be reasonably responsive during code review
- Stale PRs (>90 days without feedback) may be closed
- Re-request review after addressing feedback
- Comment to bump visibility during triage
Merge Process
PRs are managed by Myrmica Lobicornis bot:- Verifies all checks pass
- Ensures minimum reviews (2 LGTM)
- Rebases or merges with base branch if needed
- Performs squash-rebase merge by default
Labels
status/3-needs-merge- Triggers merge bot (added by maintainer)status/4-merge-in-progress- Bot is merging (automatic)bot/need-human-merge- Conflicts or issues require manual interventionbot/no-merge- Prevents automatic mergebot/light-review- Reduces required LGTMs from 2 to 1 (docs, deps, etc.)
Common Issues
Why Was My PR Closed?
PRs may be closed if:- Design conflicts: Changes conflict with codebase architecture
- Prevention: Create an issue first and discuss design
- Out of scope: Feature won’t be used or doesn’t align with goals
- Prevention: Get maintainer feedback on an issue first
- Stale: No contributor feedback for >90 days
- Prevention: Respond to review comments promptly
Why Isn’t My PR Being Reviewed?
Common reasons:Priority
We prioritize:- PRs with
contributor/wantedtag - Bug fixes (especially
bug/confirmed) - Documentation updates
- Other PRs
Not Following Best Practices
- No issue created before PR
- PR too large (should be broken up)
- Insufficient comments
- Missing or inadequate tests
- Failing CI checks
Release Freeze
During final weeks of milestone, we pause reviews to stabilize for release.Code Style Examples
Good Examples
Bad Examples
It’s OK to Push Back
Reviewers make mistakes too! If you have good reasons for doing something differently:- Politely explain your reasoning
- Provide evidence or references
- Be open to discussion
- Stay respectful
Common Sense and Courtesy
- Be respectful and professional
- Be open-minded - consider other perspectives
- Keep communication public (don’t DM maintainers)
- Stay away from defensive comments
- Express yourself clearly (many aren’t native English speakers)
- Remember: we all want to improve the project
Documentation
When changing functionality:- Update relevant documentation
- Use semantic line breaks (one sentence per line)
- Include code examples
- Update configuration references if needed
Security
Never commit:- Credentials or API keys
.envfiles with secrets- Private keys or certificates
Getting Help
Stuck? Need help?- Testing: Ask in your PR comments - we’re happy to suggest test cases
- Design: Create an issue to discuss before coding
- Review: Re-request review or comment to bump visibility
- Community: Ask on community.traefik.io
Next Steps
Now you’re ready to contribute!- Find an issue to work on
- Create your branch and make changes
- Run validation and tests locally
- Submit your PR
- Respond to review feedback