This is a modern GitHub template repository for Go projects. Use this template to create a new Go application with a standardized structure, automated tooling, and best practices built-in.
- ⚡ High Performance: Optimized build configuration with cross-compilation support and size optimization flags.
- 🐹 Go: Modern Go version with module support and following Effective Go guidelines.
- 🔧 Modern Tooling: Pre-configured with mise for tool and task management, golangci-lint for code quality, * Lefthook* for Git hooks, and act for local CI simulation.
- 📁 Structured: Adopts the Standard Go Project Layout for a clean and organized codebase.
- mise - A multi-language version manager and task runner.
- Go - Programming language (managed by mise).
- act - Run your GitHub Actions locally.
-
Clone the repository:
git clone https://github.com/TheRealZurvan/go-template.git cd go-template -
Setup environment:
# Install all required tools using mise mise install # Set up the project (download dependencies and install git hooks) mise run setup
Instructions on how to run the project.
# Run the application directly (development)
mise run run
# Build and run the production binary
mise run build
./bin/app| Script | Description |
|---|---|
mise run setup |
Set up the project dependencies |
mise run clean |
Clean build artifacts |
mise run format |
Format the code and auto-fix linting issues |
mise run lint |
Run linter (golangci-lint) |
mise run test |
Run tests |
mise run build |
Build the project |
mise run run |
Run the application |
mise run act |
Simulate CI locally with act |
We use golangci-lint for linting and formatting with 40+ linters:
# Check for linting issues
mise run lint
# Auto-fix linting issues and format code
mise run formatThis project uses Lefthook for Git hooks and follows Conventional Commits.
- Pre-commit: Formats code and runs golangci-lint.
- Commit-msg: Validates commit message format.
- Pre-push: Final lint and test checks.
# ✅ Valid commit messages
git commit -m "feat: add user authentication"
git commit -m "fix: resolve memory leak".
├── cmd/ # Application entry points
│ └── app/ # Main application
├── internal/ # Private code (business logic, config)
├── scripts/ # Helper scripts
├── bin/ # Built binaries (created by build)
├── .github/ # GitHub Actions and act configuration
├── mise.toml # Mise configuration
└── README.md # You are here! 📍
| File | Purpose | Key Features |
|---|---|---|
| mise.toml | Mise task runner | Task definitions, environment variables |
| .lefthook.yml | Git hooks | Pre-commit linting, automated quality checks |
| .golangci.yml | Linting configuration | 40+ linters, formatting rules, quality checks |
| go.mod | Go module definition | Module path, Go version requirements |
| .tool-versions | Tool version manager | Consistent versions for mise |
Contributions are welcome! Please follow these steps:
- Fork the project
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (Conventional Commits)
- Push to the branch
- Open a Pull Request
Please see SECURITY.md for our security policy and how to report security vulnerabilities.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Go for the amazing programming language
- golangci-lint for comprehensive code quality checks
- mise for tool and task management
- Lefthook for fast and reliable Git hooks
- act for local CI simulation
Happy coding! 🎉 If you find this template useful, please give it a ⭐️