Contributing Guidelines¶
Welcome to the CLI Template project! We appreciate your interest in contributing.
Getting Started¶
Prerequisites¶
Before contributing, ensure you have:
- Go 1.21+: Install Go
- Git: Install Git
- Make: Usually available on Unix-like systems
- golangci-lint: For code quality checks
- GoReleaser: For release testing
Development Setup¶
- Fork the repository on GitHub
- Clone your fork:
1 2
git clone https://github.com/yourusername/cli-template.git cd cli-template - Install dependencies:
1 2
go mod download make deps - Verify setup:
1 2 3
make test make lint make build
Development Workflow¶
Branching Strategy¶
- main: Stable, production-ready code
- develop: Integration branch for features
- feature/*: Feature development branches
- bugfix/*: Bug fix branches
- hotfix/*: Critical fixes for production
Making Changes¶
-
Create a feature branch:
1git checkout -b feature/your-feature-name -
Make your changes following our coding standards
-
Test your changes:
1 2 3
make test make lint make build -
Commit with conventional commits:
1git commit -m "feat: add new command for data processing" -
Push and create a Pull Request
Code Standards¶
Go Code Style¶
Follow standard Go conventions:
- gofmt: Use standard formatting
- golint: Follow linting recommendations
- go vet: Pass static analysis
- Comments: Document public APIs
1 2 3 4 5 6 | |
Command Implementation¶
When adding new commands:
- Separate business logic: Extract core functionality into testable action functions
- Use RunE: Prefer
RunEoverRunfor proper error handling - Accept io.Writer: Action functions should accept
io.Writerfor output
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
Testing¶
- Test coverage: Aim for 80%+ coverage
- Table-driven tests: Use for multiple scenarios
- Test naming:
TestFunctionName_Scenario - Mock external dependencies: Use interfaces
- Test action functions directly: Better unit testing
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
Documentation¶
- Code comments: Document public functions
- README updates: For significant changes
- Changelog: Follow conventional changelog format
- API docs: Update for new commands/flags
Commit Guidelines¶
Conventional Commits¶
Use Conventional Commits format:
1 2 3 4 5 | |
Types¶
- feat: New feature
- fix: Bug fix
- docs: Documentation changes
- style: Code style changes (formatting, etc.)
- refactor: Code refactoring
- test: Adding or updating tests
- chore: Maintenance tasks
- ci: CI/CD changes
Examples¶
1 2 3 4 5 6 7 8 9 10 11 | |
Pull Request Process¶
Before Submitting¶
-
Rebase on latest main:
1 2
git fetch origin git rebase origin/main -
Run full test suite:
1make all -
Update documentation if needed
-
Add/update tests for new functionality
PR Template¶
Use this template for Pull Requests:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
Review Process¶
- Automated checks must pass
- Code review by maintainers
- Manual testing if required
- Approval and merge
Issue Guidelines¶
Bug Reports¶
Use the bug report template:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
Feature Requests¶
Use the feature request template:
1 2 3 4 5 6 7 8 9 10 11 | |
Community Guidelines¶
Code of Conduct¶
- Be respectful: Treat everyone with respect
- Be inclusive: Welcome newcomers
- Be constructive: Provide helpful feedback
- Be patient: Help others learn
Communication¶
- Issues: For bugs and feature requests
- Discussions: For questions and ideas
- Pull Requests: For code contributions
- Email: For security issues
Release Process¶
Version Numbering¶
Follow Semantic Versioning: - MAJOR: Breaking changes - MINOR: New features (backward compatible) - PATCH: Bug fixes
Release Workflow¶
- Create release branch:
release/v1.0.0 - Update version: In relevant files
- Update changelog: Document changes
- Test thoroughly: Manual and automated
- Merge to main: Via pull request
- Tag release:
git tag v1.0.0 - Push tag: Triggers automated release
Recognition¶
Contributors¶
All contributors are recognized in: - CONTRIBUTORS.md: List of contributors - Release notes: Major contributions highlighted - GitHub: Contributor graph and stats
Maintainers¶
Current maintainers: - @mavogel - Project lead
Getting Help¶
Resources¶
- Documentation: docs.example.com
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Support Channels¶
- Bug reports: GitHub Issues
- Feature requests: GitHub Issues
- Questions: GitHub Discussions
- Security: Email maintainers
License¶
By contributing, you agree that your contributions will be licensed under the same license as the project.