Contributing to govman
Guidelines for contributing to the govman project.
Welcome Contributors!
Thank you for your interest in contributing to govman. All contributions are welcome:
- Bug reports
- Feature requests
- Documentation improvements
- Code contributions
Code of Conduct
- Be respectful and inclusive
- Provide constructive feedback
- Focus on what is best for the project and community
- Show empathy towards other community members
How to Contribute
Reporting Bugs
- Search existing issues to avoid duplicates
- Use the bug report template
- Include:
- govman version (
govman --version) - Operating system and version
- Shell type and version (
echo $SHELL) - Steps to reproduce
- Expected vs actual behavior
- Error messages (full output)
- govman version (
Example:
**govman version**: 1.0.0
**OS**: Ubuntu 22.04
**Shell**: bash 5.1.16
**Steps to reproduce**:
1. govman install 1.25.1
2. govman use 1.25.1
3. go version
**Expected**: go version go1.25.1 linux/amd64
**Actual**: go: command not found
**Error output**:
[paste full error]
Requesting Features
- Search existing issues for similar requests
- Describe the use case clearly
- Explain the benefit to users
- Provide examples of how it would work
Template:
**Feature**: [Brief description]
**Use case**: [Why is this needed?]
**Proposed behavior**:
```bash
govman new-command --flag
# Expected output
```
**Alternatives considered**: [Other ways to achieve this]
**Additional context**: [Any relevant information]
Improving Documentation
Documentation improvements are always welcome!
- Fork the repository
- Edit files in
docs/ - Follow markdown formatting:
- Use headers appropriately
- Include code examples
- Add cross-references where helpful
- Submit Pull Request
Development Setup
Prerequisites
- Go 1.25 or later
- Git
- Make (Linux/macOS) or equivalent
Setup Instructions
# 1. Fork the repository on GitHub
# 2. Clone your fork
git clone https://github.com/YOUR_USERNAME/govman.git
cd govman
# 3. Add upstream remote
git remote add upstream https://github.com/justjundana/govman.git
# 4. Install dependencies
go mod download
# 5. Build
make build
# 6. Run
./govman --help
# 7. Run tests
make test
Making Changes
Workflow
-
Create a branch:
git checkout -b feature/my-feature # or git checkout -b fix/bug-description -
Make your changes
- Write code
- Add tests
- Update documentation
-
Test your changes:
make test make lint -
Commit:
git add . git commit -m "feat: add new feature" -
Push:
git push origin feature/my-feature -
Create Pull Request on GitHub
Coding Standards
Go Code Style
- Follow Go Code Review Comments
- Use
gofmtfor formatting - Run
go vetbefore committing - Use meaningful variable names
- Add comments for exported functions
Example:
// Install downloads and installs the specified Go version.
// It returns an error if the version is not available or installation fails.
func (m *Manager) Install(version string) error {
resolved, err := m.ResolveVersion(version)
if err != nil {
return fmt.Errorf("failed to resolve version: %w", err)
}
// ... implementation
}
Commit Messages
Use Conventional Commits:
type(scope): description
[optional body]
[optional footer]
Types:
feat: New featurefix: Bug fixdocs: Documentation changestest: Test changesrefactor: Code refactoringchore: Maintenance tasksperf: Performance improvements
Examples:
feat: add support for Fish shell
fix: resolve symlink creation on Windows
docs: update installation instructions
test: add tests for version resolution
refactor: simplify download logic
chore: update dependencies
Testing
Writing Tests
- Test files:
*_test.goalongside implementation - Test functions:
func TestFeatureName(t *testing.T) - Use table-driven tests for multiple scenarios
- Test both happy path and error cases
Example:
func TestManager_ResolveVersion(t *testing.T) {
testCases := []struct {
name string
input string
expected string
wantErr bool
}{
{
name: "latest resolves to newest stable",
input: "latest",
expected: "1.25.1",
wantErr: false,
},
{
name: "partial version resolves",
input: "1.25",
expected: "1.25.1",
wantErr: false,
},
{
name: "invalid version errors",
input: "99.99.99",
expected: "",
wantErr: true,
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
// Test implementation
})
}
}
Running Tests
# Run all tests
make test
# Run specific package
go test ./internal/manager/
# Run with coverage
make test-coverage
# Run specific test
go test -run TestManager_Install ./internal/manager/
# Verbose output
go test -v ./...
Documentation
Update documentation for:
- New commands: Update
docs/commands.md - Configuration changes: Update
docs/configuration.md - New features: Update relevant docs and
docs/examples.md - Breaking changes: Update
CHANGELOG.mdand migration guides
Pull Request Process
Before Submitting
- Code follows style guidelines
- Tests added/updated
- All tests pass
- Documentation updated
- Commit messages follow convention
- Branch is up-to-date with main
PR Description
Use this template:
## Description
[Clear description of changes]
## Type of Change
- [ ] Bug fix (non-breaking)
- [ ] New feature (non-breaking)
- [ ] Breaking change
- [ ] Documentation update
## Testing
[How you tested your changes]
## Checklist
- [ ] Tests pass
- [ ] Linters pass
- [ ] Documentation updated
- [ ] CHANGELOG.md updated (if applicable)
## Related Issues
Fixes #123
Review Process
- Automated checks: Must pass CI/CD
- Code review: Maintainers will review
- Feedback: Address comments/suggestions
- Approval: At least one maintainer approval required
- Merge: Squash and merge to main
After Merge
- Your contribution will be in the next release
- You'll be credited in release notes
- Thank you for contributing!
Areas Needing Help
Good first issues:
- Documentation improvements
- Test coverage improvements
- Error message enhancements
- Platform-specific testing
Medium complexity:
- New shell support
- Performance optimizations
- New commands/features
Advanced:
- Core architecture changes
- Security enhancements
- Cross-platform compatibility
Development Tips
Debugging
# Verbose mode
govman --verbose install 1.25.1
# Using delve debugger
dlv debug ./cmd/govman -- install 1.25.1
(dlv) break main.main
(dlv) continue
Testing Locally
# Build and test
make build
./govman install 1.25.1
# Test on different platforms (requires Docker)
docker run --rm -v $(pwd):/app -w /app golang:1.21 make build
Useful Commands
# Format code
make fmt
# Run linters
make lint
# Build for all platforms
make release
# Clean build artifacts
make clean
# View coverage
go tool cover -html=coverage.out
Release Process
(For maintainers)
- Update version in
internal/version/version.go - Update
CHANGELOG.md - Create tag:
git tag -a v1.0.0 -m "Release v1.0.0" - Push tag:
git push origin v1.0.0 - GitHub Actions builds and publishes
- Create GitHub Release with notes
Questions?
- Documentation: See
docs/directory - Discussions: Use GitHub Discussions
- Issues: Open an issue for bugs/features
- Contact: [maintainer email if available]
License
By contributing, you agree that your contributions will be licensed under the Apache 2.0 License.
Recognition
Contributors are recognized in:
- Release notes
- CONTRIBUTORS file
- Project README (for significant contributions)
Thank you for making govman better!