Version: v1.0.0
Last Updated: October 15, 2025
Complete guide to Gopherβs Makefile commands for development and CI/CD.
# First time setup
make setup # Install dependencies and tools
# Before committing
make ci # Run all CI checks locally
# If all green, push!
git push
| Command | Description | Time |
|---|---|---|
make build |
Build binary | ~3s |
make build-all |
Build for all platforms | ~15s |
make install |
Install to system (/usr/local/bin) | ~3s |
make clean |
Clean build artifacts | ~1s |
Example:
make build
./build/gopher version
| Command | Description | Race Detection | Time |
|---|---|---|---|
make test |
Tests + coverage + race detection | β Yes | ~18s |
make test-verbose |
Verbose output | β No | ~9s |
make test-coverage |
Detailed coverage report | β Yes | ~18s |
Note: All tests now include race detection by default (matches CI behavior).
Example:
# Run tests (includes race detection and coverage)
make test
# Verbose output
make test-verbose
# Detailed coverage report
make test-coverage
| Command | Description | Fixes Issues |
|βββ|ββββ-|βββββ|
| make fmt | Format code with go fmt | β
Yes |
| make check-format | Check formatting (CI mode) | β No |
| Command | Description | Fixes Issues |
|βββ|ββββ-|βββββ|
| make imports | Fix imports with goimports | β
Yes |
| make check-imports | Check imports (CI mode) | β No |
| Command | Description | Includes |
|βββ|ββββ-|βββ-|
| make format | Format code and imports | fmt + imports |
| Command | Description | Time |
|βββ|ββββ-|ββ|
| make lint | Run golangci-lint | ~8s |
| make vet | Run go vet | ~2s |
Example:
# Fix formatting and imports (comprehensive)
make format
# Check without modifying (CI mode)
make check-format check-imports
# Run linter
make lint
| Command | Description | Includes | Time |
|---|---|---|---|
make ci |
ALL CI checks (matches GitHub Actions) | check-format + check-imports + vet + lint + test | ~20s |
make check |
Development checks (modifies files) | fmt + vet + test | ~18s |
Recommendation: Use make ci before every push to ensure GitHub Actions will pass.
What make ci runs:
Example:
# Before committing - run CI checks locally
make ci
# If all green, you're ready to push:
git add .
git commit -m "feat: add feature"
git push # β
GitHub Actions will pass!
| Command | Description | Requires |
|---|---|---|
make release |
Build for all platforms | Tests pass |
make dist |
Create distribution packages | make release |
make goreleaser-check |
Validate GoReleaser config | GoReleaser installed |
make goreleaser-snapshot |
Test release build | GoReleaser installed |
make validate-release TAG=vX.Y.Z |
Validate release | Scripts in place |
make create-tag TAG=vX.Y.Z |
Create and push tag | Git clean |
Example:
# Prepare release
make release
make dist
# Create release tag
make create-tag TAG=v1.0.0
| Command | Description |
|---|---|
make deps |
Download dependencies |
make tidy |
Tidy go.mod and go.sum |
make version |
Show version info |
make install-tools |
Install dev tools (goimports, staticcheck, etc.) |
make setup |
Complete development setup |
Example:
# New contributor setup
make setup
# Verify setup
make ci
| Command | Description | Tool |
|---|---|---|
make security-scan |
Security scan | staticcheck + vet |
make vuln-check |
Vulnerability check | govulncheck |
make security-all |
All security checks | All above |
Example:
# Check for vulnerabilities
make vuln-check
# Full security audit
make security-all
| Command | Description |
|---|---|
make docker-build |
Build Docker images |
make docker-test |
Run tests in Docker |
make docker-clean |
Clean Docker images |
Note: For specific scenarios, use ./docker/build.sh <scenario>
git clone https://github.com/molmedoz/gopher
cd gopher
make setup # Install dependencies and tools
make ci # Verify everything works
# Make changes
vim internal/runtime/manager.go
# Quick test
make test
# Format and check
make fmt imports
make ci
# If all green, commit
git add .
git commit -m "fix: improve manager"
git push
# Run full CI locally
make ci
# Check for race conditions
make test-race
# If both pass, create PR
git push origin feature-branch
# CI failed? Reproduce locally:
make ci
# Check specific step
make fmt-check # Formatting issue?
make imports-check # Import issue?
make lint-ci # Lint issue?
make test # Test failure?
# Fix and verify
make fmt imports
make ci
# Run all checks
make ci
make test-race
# Build release
make release
# Create tag
make create-tag TAG=v1.0.0
Makefile uses colored output:
# Fastest check
make fmt test
# Skip slow linters during iteration
make fmt imports test
# Full CI suite
make ci # ~20s
# Or with race detection
make ci-race # ~40s
# Run tests in parallel
go test -parallel 4 ./...
# See: https://golangci-lint.run/usage/install/
# macOS:
brew install golangci-lint
# Linux:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
make clean
make deps
make test
make test
open coverage.html # macOS
xdg-open coverage.html # Linux
| CI Step | Makefile Command | What It Does |
|---|---|---|
| Lint | make lint-ci |
fmt-check + imports-check + staticcheck |
| Test | make test |
Tests with coverage (NO race) |
| Build | make build |
Build binary |
| Full CI | make ci |
All of the above |
To reproduce CI locally: make ci
# 1. Setup (once)
make setup
# 2. Develop
vim cmd/gopher/main.go
# 3. Quick check
make test
# 4. Before commit
make fmt imports
make ci
# 5. Commit and push
git commit -am "feat: add feature"
git push
# 6. CI runs automatically with same commands!
# With custom version
VERSION=1.0.0 make build
# With custom flags
LDFLAGS="-X main.version=custom" make build
# Test specific package
go test ./internal/runtime -v
# Test specific function
go test ./internal/runtime -run TestAliasManager -v
# Generate coverage
make test
# View in browser
open coverage.html
# View in terminal
go tool cover -func=coverage.out
| Use Case | Command | Race Detection | Time |
|---|---|---|---|
| Quick iteration | make test |
β No | ~9s |
| Before commit | make ci |
β No | ~20s |
| Working on concurrency | make test-race |
β Yes | ~18s |
| Comprehensive check | make ci-race |
β Yes | ~40s |
| CI Pipeline | make ci |
β No | ~20s |
Philosophy: Fast feedback by default, comprehensive when needed.
Version: v1.0.0
Status: Production ready β