Thank you for your interest in contributing to gitconfig! This document provides guidelines and instructions for contributing.
Please be respectful and constructive in all interactions within this project.
- Go 1.24 or later
- Git
- Make
- Clone the repository:
git clone https://github.com/gopasspw/gitconfig.git
cd gitconfig- Install dependencies:
go mod tidy- Verify your setup:
make test
make codequalityAll tests should pass and no linting errors should be reported.
Please see Development Workflow.
# Run all tests
make test
# Run specific test
go test -v -run TestName
# Run with race detection
go test -race ./...- Test location: Add tests to
*_test.gofiles next to source code - Test naming: Use
TestFunctionNameorTestFunctionName_Scenario - Test structure: Use table-driven tests where practical
- Parallel tests: Add
t.Parallel()to tests that don't rely on shared state - Assertions: Use
testify/assertandtestify/require
Example test:
func TestMyFeature(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
input string
want string
wantErr bool
}{
{
name: "simple case",
input: "test",
want: "result",
wantErr: false,
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
got, err := MyFunction(tc.input)
if tc.wantErr {
assert.Error(t, err)
} else {
assert.NoError(t, err)
assert.Equal(t, tc.want, got)
}
})
}
}When adding new functionality:
- Aim for >80% code coverage
- Test both the success path and error cases
- Include edge case tests
- Document why certain edge cases are important
Use conventional commit format:
type(scope): short description
Longer explanation if needed. Wrap at 72 characters.
Additional context and motivation.
Fixes #123
Common types:
feat: New featurefix: Bug fixdocs: Documentation changetest: Test addition or modificationrefactor: Code refactoringperf: Performance improvementchore: Build, dependencies, or tooling
Example:
feat(parser): add support for bare boolean values
Add parsing support for bare boolean values in gitconfig files
as per git-config specification. Previously these were silently
ignored.
Fixes #42
-
Ensure all tests pass:
make test -
Run code quality checks:
make codequality make fmt
-
Verify cross-compilation works (if changing platform-specific code):
make crosscompile
-
Update documentation if you changed:
- Public API (update godoc comments)
- User-facing behavior (update README.md, doc.go)
- Configuration handling (update CONFIG_FORMAT.md)
- Push your branch to your fork
- Create a pull request with a clear title and description
- Link related issues using
Closes #123orFixes #456 - Include any relevant documentation changes
- Be ready to respond to code review comments
## Description
Clear description of what changes and why.
## Type of Change
- [ ] Bug fix (non-breaking)
- [ ] New feature (non-breaking)
- [ ] Breaking change
## How to Test
Steps to verify the changes work.
## Checklist
- [ ] Tests pass locally
- [ ] Code formatted with `make fmt`
- [ ] Linting passes with `make codequality`
- [ ] Documentation updated
- [ ] No new dependencies added (or justified)Expect constructive feedback on:
- Code clarity and maintainability
- Test coverage
- Documentation completeness
- API design consistency
- Performance implications
- Implement the function
- Add godoc comment with:
- What it does
- Parameters and return values
- Examples
- Any error conditions
- Add tests covering normal and error cases
- Run
make fmtandmake codequality
- Check if behavior change is breaking
- Update godoc if behavior changed
- Add/update tests
- Update related documentation
Before adding a new dependency:
- Check if stdlib or existing deps can solve the problem
- Verify license compatibility (must be MIT or compatible)
- Ensure it's pure Go (no CGo)
- Document why it's needed in DEPENDENCIES.md
- Open an issue to discuss before implementing
- Questions: Open a discussion or issue
- Bug reports: Include reproduction steps, environment, Go version
- Feature requests: Describe the use case and motivation
- Design discussions: Open an issue to discuss before implementing
- git-config documentation
- ARCHITECTURE.md - Design and structure
- CONFIG_FORMAT.md - Supported syntax
- DEVELOPMENT.md - Deeper technical details
By contributing, you agree that your contributions will be licensed under the MIT License, consistent with the project's license.
Contributors are valued and important to this project. Your contributions help make gitconfig better for everyone.
Thank you for contributing! 🎉