This document provides guidelines and instructions for contributing to this project.
Please be respectful and considerate of others when contributing to this project. We aim to foster an inclusive and welcoming environment for everyone.
- Go 1.24 or later
- Git
-
Fork the repository on GitHub
-
Clone your fork locally:
git clone https://github.com/your-username/hammerclock.git cd hammerclock -
Add the original repository as an upstream remote:
git remote add upstream https://github.com/itworks99/hammerclock.git -
Install dependencies:
go mod download -
Build the project:
go build -o bin/hammerclock.exe cmd/hammerclock/main.go
The project follows this structure:
/cmd/hammerclock/main.go- Application entry point/internal/hammerclock/- Core application codemodel.go- Model initializationupdate.go- Update logicview.go- View rendering/common/- Shared types and messages/config/- Application configuration/logging/- Game session logging/options/- User options management/palette/- Color theme definitions/ui/- UI components
See ARCHITECTURE.MD for more details about the application design.
main: Production-ready codedevelop: Development branch for integrating features- Feature branches: Create from
developwith the naming conventionfeature/feature-name - Bug fix branches: Create from
developwith the naming conventionfix/bug-name
- Use clear, descriptive commit messages
- Begin commit messages with a verb in the imperative mood (e.g., "Add", "Fix", "Update")
- Reference issue numbers in commit messages when applicable
- Create a new branch from
develop - Make your changes in small, logical commits
- Push your branch to your fork
- Create a pull request to the
developbranch of the original repository - Include a clear description of the changes and any relevant issue numbers
See ARCHITECTURE.MD for more details about the application design.
- Follow standard Go style conventions
- Use
gofmtto format your code - Keep functions small and focused
- Write descriptive variable and function names
- Add comments for complex logic
- Update documentation when making significant changes
- Document public functions, types, and methods
- Include examples where appropriate
- Update the README.md when adding new features or changing existing functionality
-
Write tests for new features and bug fixes
-
Run tests before creating pull requests:
go test ./... -
Make sure deadlock tests pass:
go test -v ./test/
To build and run the application:
go build -o hammerclock.exe cmd/hammerclock/main.go
./hammerclock.exe
For development with live reloading, you can use the air tool:
-
Install air:
go install github.com/cosmtrek/air@latest -
Create a
.air.tomlconfiguration file in the project root with:root = "." tmp_dir = "tmp" [build] cmd = "go build -o ./tmp/main.exe ./cmd/hammerclock" bin = "tmp/main.exe" include_ext = ["go", "json"] exclude_dir = ["vendor", "bin"]
-
Run air:
air