Thank you for your interest in contributing to Camera Workflow! This guide will help you get started with contributing code, documentation, bug reports, and feature requests.
# Fork the repository on GitHub, then clone your forkgit clone https://github.com/YOUR_USERNAME/Camera-Workflow.gitcd Camera-Workflow# Add upstream remotegit remote add upstream https://github.com/Azilone/Camera-Workflow.git
Use gofmt for formatting (automatic with make fmt)
Write clear, descriptive variable names
Add comments for exported functions
Keep functions focused and small
// Good: Clear function with documentation// CalculateChecksum computes the xxHash64 checksum for the given file.// Returns an error if the file cannot be read.func CalculateChecksum(path string) (uint64, error) { file, err := os.Open(path) if err != nil { return 0, fmt.Errorf("open file: %w", err) } defer file.Close() return hasher.CalculateReader(file)}
2. Write Tests
Add tests for new functionality:
func TestCalculateChecksum(t *testing.T) { // Create test file tmpfile := createTempFile(t, "test content") // Test checksum calculation sum, err := CalculateChecksum(tmpfile) if err != nil { t.Fatalf("unexpected error: %v", err) } if sum == 0 { t.Error("expected non-zero checksum") }}
feat: add adaptive worker scaling for video conversionImplements dynamic worker pool adjustment based on CPUand memory usage during video conversions.Closes #123
fix: handle edge case in date extractionFixes crash when EXIF data contains invalid dates.
type ConversionError struct { Path string Err error}func (e *ConversionError) Error() string { return fmt.Sprintf("conversion failed for %s: %v", e.Path, e.Err)}
Documentation
Document all exported symbols:
// NewConverter creates a new Converter instance with the provided// configuration and logger. It initializes the security checker,// statistics tracker, and checksum hasher.func NewConverter(cfg *config.Config, log *logger.Logger) *Converter { // ...}
Use examples for complex functions:
// GetFileDate extracts the creation date from file metadata.// It tries multiple sources in priority order:// 1. macOS mdls metadata (most reliable for RAW files)// 2. EXIF data (for images)// 3. Video metadata (for videos)// 4. File modification time (fallback)//// Example:// date, err := GetFileDate("/path/to/photo.jpg")// if err != nil {// log.Error(err)// }func GetFileDate(path string) (time.Time, error) { // ...}
## Feature DescriptionDescribe the feature you'd like to see.## Use CaseExplain why this feature is needed and who would benefit.## Proposed Implementation(Optional) How you think it could be implemented.## Alternatives Considered(Optional) Other approaches you've considered.