# Task — Fast Cross-Platform Build Tool for Modern Workflows > Task is a task runner and build tool written in Go. It uses simple YAML configuration as a modern, cross-platform alternative to Make — with better syntax, built-in variables, watch mode, and no platform-specific quirks. ## Install Save in your project root: # Task — Fast Cross-Platform Build Tool for Modern Workflows ## Quick Use ```bash # Install Task brew install go-task # Or: go install github.com/go-task/task/v3/cmd/task@latest # Create a Taskfile cat > Taskfile.yml << 'EOF' version: "3" tasks: build: cmds: - go build -o bin/app . test: cmds: - go test ./... dev: cmds: - task: build - ./bin/app serve EOF # Run tasks task build task test task dev ``` ## Introduction Task is a modern replacement for Make. While Make is powerful, its syntax is arcane (tabs vs spaces matter!), it is platform-dependent (GNU Make vs BSD Make), and its Makefile format is hostile to newcomers. Task uses simple, readable YAML with built-in features that Make needs plugins or shell tricks for. With over 15,000 GitHub stars, Task has gained popularity across the Go community and beyond. It works on Linux, macOS, and Windows identically — no more "this Makefile only works on Linux" problems. ## What Task Does Task reads a Taskfile.yml and executes named tasks. Each task runs shell commands, can depend on other tasks, supports variables, conditions, watch mode (re-run on file changes), and parallel execution. It is a single static binary with no dependencies. ## Architecture Overview ``` [Taskfile.yml] YAML-based task definitions | [Task Runner (Go)] Parse YAML Resolve dependencies Execute commands | [Features] +-------+-------+-------+ | | | | [Deps] [Vars] [Watch] Task Template File change dependency variables detection resolution .env files auto-rerun | [Cross-Platform] Linux, macOS, Windows Same Taskfile everywhere ``` ## Self-Hosting & Configuration ```yaml # Taskfile.yml — comprehensive example version: "3" vars: APP_NAME: myapp VERSION: sh: git describe --tags --always dotenv: [".env"] tasks: default: cmds: - task --list build: desc: Build the application cmds: - go build -ldflags "-X main.version={{.VERSION}}" -o bin/{{.APP_NAME}} . sources: - "**/*.go" generates: - bin/{{.APP_NAME}} test: desc: Run tests cmds: - go test -v -race -coverprofile=coverage.out ./... lint: desc: Run linter cmds: - golangci-lint run dev: desc: Development mode with live reload watch: true sources: - "**/*.go" cmds: - task: build - ./bin/{{.APP_NAME}} serve docker: desc: Build Docker image cmds: - docker build -t {{.APP_NAME}}:{{.VERSION}} . ci: desc: Run full CI pipeline cmds: - task: lint - task: test - task: build clean: desc: Remove build artifacts cmds: - rm -rf bin/ coverage.out ``` ## Key Features - **YAML Syntax** — readable, no tab/space issues like Make - **Cross-Platform** — identical behavior on Linux, macOS, Windows - **Dependencies** — tasks can depend on other tasks - **Variables** — static, dynamic (from shell), and .env file support - **Watch Mode** — re-run tasks on file changes (built-in live reload) - **Up-to-Date Checks** — skip tasks if sources have not changed - **Parallel Execution** — run tasks concurrently - **Task Descriptions** — self-documenting with task --list ## Comparison with Similar Tools | Feature | Task | Make | Just | Mage | npm scripts | |---|---|---|---|---|---| | Config Format | YAML | Makefile | Justfile | Go code | JSON | | Cross-Platform | Yes | No (GNU vs BSD) | Yes | Yes | Yes | | Watch Mode | Built-in | No | No | Manual | Via nodemon | | Up-to-Date | Built-in | Built-in | No | Manual | No | | Variables | YAML + shell + .env | Make vars | Just vars | Go | Limited | | Learning Curve | Very Low | Moderate | Low | Go knowledge | Very Low | | Language Agnostic | Yes | Yes | Yes | Go only | Node.js | | Best For | Modern projects | C/C++ tradition | Simple commands | Go projects | Node.js | ## FAQ **Q: Task vs Make — why switch?** A: Task for readable YAML config, cross-platform support, built-in watch mode, and no tab/space foot-guns. Make for C/C++ projects, when Makefile is the established convention, or when you need Make-specific features. **Q: Task vs Just — how do they differ?** A: Task has more features (watch mode, up-to-date checks, .env support, parallel execution). Just is simpler with a more minimal command-runner focus. Choose based on feature needs. **Q: Can I use Task for non-Go projects?** A: Absolutely. Task is language-agnostic. It runs shell commands, so it works for Python, Node.js, Rust, or any project that needs a task runner. **Q: How does watch mode work?** A: Add "watch: true" and "sources" to a task. Task monitors the specified files and re-runs the task whenever they change — built-in live reload without external tools. ## Sources - GitHub: https://github.com/go-task/task - Documentation: https://taskfile.dev - Created by Andrey Nering - License: MIT --- Source: https://tokrepo.com/en/workflows/110f3e58-373d-11f1-9bc6-00163e2b0d79 Author: AI Open Source