Thank you for considering contributing to the HDF5 Go Library! This document outlines the development workflow and guidelines.
This project uses GitHub Flow - a simplified branching model.
main # Production-ready code (tagged releases)
├─ feature/* # New features
├─ fix/* # Bug fixes
└─ release/* # Release preparation (for version updates)
legacy # Historical development (read-only archive)
- main: Production-ready code. Protected branch - all changes via PRs only.
- feature/*: New features. Branch from
main, merge via PR with squash. - fix/*: Bug fixes. Branch from
main, merge via PR with squash. - release/*: Release preparation. Used for version bumps and changelog updates.
# Create feature branch from main
git checkout main
git pull origin main
git checkout -b feature/my-new-feature
# Work on your feature (multiple commits OK)...
git add .
git commit -m "feat: add my new feature"
# Push and create PR
git push origin feature/my-new-feature
gh pr create --title "feat: add my new feature" --body "Description..."
# Wait for CI green, then merge with squash
gh pr checks --watch
gh pr merge --squash --delete-branch# Create fix branch from main
git checkout main
git pull origin main
git checkout -b fix/issue-123
# Fix the bug...
git add .
git commit -m "fix: resolve issue #123"
# Push and create PR
git push origin fix/issue-123
gh pr create --title "fix: resolve issue #123" --body "Fixes #123"
# Wait for CI green, then merge with squash
gh pr checks --watch
gh pr merge --squash --delete-branch# Create release branch from main
git checkout main
git pull origin main
git checkout -b release/v1.0.0
# Update version numbers, CHANGELOG, etc.
git add .
git commit -m "chore: prepare release v1.0.0"
# Push and create PR
git push origin release/v1.0.0
gh pr create --title "Release v1.0.0" --body "Release notes..."
# Wait for CI green, then merge with squash
gh pr checks --watch
gh pr merge --squash --delete-branch
# After PR merged, create tag on main
git checkout main
git pull origin main
git tag -a v1.0.0 -m "Release v1.0.0"
git push origin --tagsSame as regular bug fix - use fix/ branch and PR workflow.
Hotfixes follow the same process since we work directly with main.
Follow Conventional Commits specification:
<type>(<scope>): <description>
[optional body]
[optional footer]
- 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 (build, dependencies, etc.)
- perf: Performance improvements
feat: add support for compound datatypes
fix: correct endianness handling in superblock
docs: update README with new examples
refactor: simplify datatype parsing logic
test: add tests for chunked dataset reading
chore: update golangci-lint configuration-
Format code:
make fmt
-
Run linter:
make lint
-
Run tests:
make test -
All-in-one:
make pre-commit
- Code is formatted (
make fmt) - Linter passes (
make lint) - All tests pass (
make test) - New code has tests (minimum 70% coverage)
- Documentation updated (if applicable)
- Commit messages follow conventions
- No sensitive data (credentials, tokens, etc.)
- Go 1.25 or later
- golangci-lint
- Python 3 with h5py and numpy (for test file generation)
# Install golangci-lint
make install-lint
# Install Python dependencies (optional, for test files)
pip install h5py numpy# Run all tests
make test
# Run with coverage
make test-coverage
# Run with race detector
make test-race
# Run benchmarks
make benchmark# Run linter
make lint
# Save linter report
make lint-reporthdf5/
├── .golangci.yml # Linter configuration
├── Makefile # Development commands
├── cmd/ # Command-line utilities
├── docs/ # Documentation
├── examples/ # Usage examples
├── internal/ # Internal implementation
│ ├── core/ # Core HDF5 structures
│ ├── structures/ # HDF5 data structures
│ ├── testing/ # Test utilities
│ └── utils/ # Utility functions
├── testdata/ # Test HDF5 files
├── file.go # Public API - File operations
├── group.go # Public API - Groups & Datasets
└── README.md # Main documentation
- Check if issue exists, if not create one
- Discuss approach in the issue
- Create feature branch from
main - Implement feature with tests
- Update documentation
- Run quality checks (
make pre-commit) - Create pull request to
main - Wait for CI green and code review
- Address feedback
- Merge with squash when approved
- Follow Go conventions and idioms
- Write self-documenting code
- Add comments for complex logic
- Keep functions small and focused
- Use meaningful variable names
- Public types/functions:
PascalCase(e.g.,ReadSuperblock) - Private types/functions:
camelCase(e.g.,readSignature) - Constants:
PascalCasewith context prefix (e.g.,Version0) - Test functions:
Test*(e.g.,TestReadSuperblock)
- Always check and handle errors
- Use
utils.WrapError(context, err)to add context - Never ignore errors
- Validate inputs
- Use
testify/requirefor assertions - Test both success and error cases
- Use table-driven tests when appropriate
- Mock external dependencies
- Check existing issues and discussions
- Read documentation in
docs/ - Review architecture documentation in
docs/architecture/ - Ask questions in GitHub Issues
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to the HDF5 Go Library! 🎉