Thank you for your interest in contributing! This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- Development Setup
- Making Changes
- Testing
- Code Style
- Pull Request Process
- Adding New Display Drivers
This project follows the standard open source code of conduct. Be respectful, constructive, and professional in all interactions.
- Fork the repository
- Clone your fork:
git clone git@github.com:YOUR_USERNAME/i2c-display.git - Add upstream remote:
git remote add upstream git@github.com:ausil/i2c-display.git - Create a feature branch:
git checkout -b feature/my-feature
- Go 1.24 or later
- Make
- golangci-lint (for linting)
go mod download# golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/binmake buildmake testmake lintfeature/- New featuresfix/- Bug fixesdocs/- Documentation changesrefactor/- Code refactoringtest/- Test improvements
Use clear, descriptive commit messages:
Short summary (50 chars or less)
Detailed explanation if needed. Wrap at 72 characters.
- Bullet points are okay
- Use present tense: "Add feature" not "Added feature"
- Reference issues: "Fixes #123" or "Related to #456"
All new code must include unit tests. Aim for >80% coverage.
make testTest without hardware using the mock display:
make run-mockIf you have access to hardware, run integration tests:
make test-hardware- Follow standard Go conventions
- Use
gofmtandgoimports - Run
make fmtbefore committing - Follow the existing code structure
import (
// Standard library
"context"
"fmt"
// External packages
"github.com/rs/zerolog"
// Internal packages
"github.com/ausil/i2c-display/internal/config"
"github.com/ausil/i2c-display/internal/logger"
)- Always check and handle errors
- Use structured logging with context
- Return errors with
fmt.Errorfand%wfor wrapping
if err != nil {
return fmt.Errorf("failed to initialize display: %w", err)
}Use the structured logger, not fmt.Print or log:
log.With().
Str("display_type", displayType).
Int("width", width).
Logger().Info("Initializing display")-
Update your fork
git fetch upstream git rebase upstream/main
-
Run all checks
make fmt make lint make test -
Push to your fork
git push origin feature/my-feature
-
Create Pull Request
- Provide a clear description
- Reference related issues
- Include screenshots for UI changes
- Ensure CI passes
-
Code Review
- Address review comments
- Keep commits clean (squash if needed)
- Be responsive to feedback
See DISPLAY_TYPES.md for detailed instructions on adding support for new display types.
- Create driver file -
internal/display/YOUR_DISPLAY.go - Implement Display interface - All required methods
- Update factory - Add to
internal/display/factory.go - Add display specs - Update
internal/config/display_specs.go - Create example config -
configs/config.YOUR_DISPLAY.json - Add tests - Unit tests for the new driver
- Update documentation - README.md and DISPLAY_TYPES.md
Use internal/display/TEMPLATE.go.example as a starting point for new drivers.
i2c-display/
├── cmd/
│ └── i2c-displayd/ # Main application
├── internal/
│ ├── config/ # Configuration management
│ ├── display/ # Display drivers
│ ├── health/ # Health checking
│ ├── logger/ # Structured logging
│ ├── metrics/ # Prometheus metrics
│ ├── renderer/ # Page rendering
│ ├── retry/ # Retry logic
│ ├── rotation/ # Page rotation
│ └── stats/ # System statistics
├── configs/ # Example configurations
├── testdata/ # Test fixtures
└── .github/workflows/ # CI/CD pipelines
- Open an issue for bugs or feature requests
- Tag issues appropriately
- Be patient and respectful
Thank you for contributing!