This guide covers the development workflow for contributing to Atmos.
- Go 1.24+ (see go.mod for exact version)
- Make
- Git
- Clone the repository
- Run the development setup:
This will:
atmos dev setup
- Install Go dependencies
- Install pre-commit and golangci-lint (using brew, apt, or pip)
- Set up pre-commit hooks
- Install required Go tools
We use Atmos custom commands for development (dogfooding our own tool). This ensures we experience the same workflows our users do. See Atmos Custom Commands for more details.
# Checking Commands (Read-only, no modifications)
atmos dev check # Check staged files for issues
atmos dev check-pr # Check PR changes for issues
atmos dev check-all # Check all files for issues
atmos dev lint # Run golangci-lint
# Formatting Commands (Modifies files)
atmos dev format # Auto-format staged files
atmos dev format-pr # Auto-format PR changes
atmos dev format-all # ⚠️ DANGEROUS: Auto-format ALL files
# Build and Test Commands
atmos dev test # Run tests
atmos dev build # Build the Atmos binary
atmos dev quick # Quick build and test
atmos dev help # Show all available dev commandsTraditional make commands are also available:
make build # Build the Atmos binary
make test # Run tests
make lint # Run golangci-lint on changed filesWe use pre-commit hooks to ensure code quality. The following hooks run automatically on git commit:
Important distinction:
- Check commands are read-only and will NOT modify any files. They only report issues.
- Format commands WILL modify files to fix issues automatically.
atmos dev check- Checks only staged files (best before committing)atmos dev check-pr- Checks files changed from main branch (best for PR reviews)atmos dev check-all- Checks all files in the repository
atmos dev format- Auto-formats only staged filesatmos dev format-pr- Auto-formats files changed from main branchatmos dev format-all-⚠️ DANGEROUS: Auto-formats ALL files (use with extreme caution)
Note: Golden snapshots and test fixtures are always protected from formatting.
- go-fumpt: Enforces consistent Go formatting (stricter than gofmt)
- go-build-mod: Verifies code compiles
- go-mod-tidy: Ensures go.mod and go.sum are clean
- golangci-lint: Comprehensive linting to prevent massive functions and files
- trailing-whitespace: Removes trailing whitespace
- end-of-file-fixer: Ensures files end with a newline
- check-yaml: Validates YAML syntax
- check-added-large-files: Prevents committing large files (>500KB)
golangci-lint is critical for maintaining code quality. It runs both locally (via pre-commit) and in CI. The linter enforces:
- Function complexity limits
- File size limits
- Code style consistency
- Bug detection
- Performance improvements
Configuration is in .golangci.yml.
Pull requests trigger the pre-commit workflow which:
- Runs all pre-commit hooks on changed files only (not the entire codebase)
- Ensures code quality before merge
If hooks aren't running on commit:
pre-commit installIf golangci-lint fails with Go version issues:
# Reinstall with brew (recommended)
brew upgrade golangci-lint
# Or use the installer
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin# Skip hooks for a single commit (use sparingly)
git commit --no-verify -m "message"
# Run hooks manually
pre-commit run --all-files
# Update hooks to latest versions
pre-commit autoupdateThe scripts/test-geodesic-prebuilt.sh script allows you to quickly test Atmos changes inside a Geodesic container without rebuilding the entire Geodesic image.
Usage:
./scripts/test-geodesic-prebuilt.sh <path-to-infrastructure>Example:
./scripts/test-geodesic-prebuilt.sh ~/Dev/cloudposse/infra/infra-liveWhat it does:
- Builds Atmos for Linux (cross-compiles if needed for your architecture)
- Launches a Geodesic container with:
- The pre-built Atmos binary mounted to
/usr/local/bin/atmos - Your infrastructure directory mounted to
/workspace - Atmos-managed AWS credentials from
~/.config/atmos/(following XDG conventions) - Standard XDG environment variables configured
- The pre-built Atmos binary mounted to
This workflow is much faster than rebuilding Geodesic images during development and allows you to iterate quickly on Atmos changes while testing in a realistic containerized environment.
.pre-commit-config.yaml- Pre-commit hooks configuration.golangci.yml- golangci-lint rules.github/workflows/pre-commit.yml- CI workflow for pre-commit.atmos.d/dev.yaml- Atmos custom development commands