
Taskfile - modern Makefile alternative
Pre-requisites
Introduction
Taskfile is a modern Makefile alternative that is easier to use and understand. It is a simple automation tool that allows you to define tasks in a single file. I will try to show you how to use it in a simple way.
Advantages of Taskfile
- Reduce complexity and improve readability of your automation scripts.
- It is easier to use and understand than Makefile.
- It is a cross-platform tool that works on Linux, MacOS, and Windows.
Installation
You can install Taskfile by running the following command:
curl -sL https://taskfile.dev/install.sh | sh
Example project wih Golang and Docker:
I’ve prepred a simple project with Golang and Docker. The project structure looks like this: Taskfile.yaml in the root directory and I’ve created .taskfiles directory with two subdirectories GoLang and Docker. Each subdirectory contains a Taskfile.yaml file with tasks for Golang and Docker.
Root Taskfile.yaml:
---
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
env:
IMAGE: "replaceme"
includes:
golang: .taskfiles/GoLang/Taskfile.yaml
docker: .taskfiles/Docker/Taskfile.yaml
tasks:
default:
silent: true
cmd: task -l
If you would like to see the tasks for Golang or Docker, you can run the following command:
task -l
You will see the list of tasks for Golang and Docker.

Taskfile for Docker:
version: 3
tasks:
build:
desc: Build docker
cmds:
- docker build -t ${IMAGE} {{.ROOT_DIR}}
run:
desc: "Run docker compose"
cmds:
- docker-compose up --build
Taskfile for Golang:
version: 3
tasks:
build:
desc: Build the binary
cmds:
- go build -o app cmd/server/main.go
test:
desc: "Run the tests"
cmds:
- go test -v ./...
lint:
desc: "Run the linter"
cmds:
- golangci-lint run
preconditions:
- msg: "Go linter not installed"
sh: "golangci-lint --version"
Take a look at the preconditions section in the lint task. It checks if the golangci-lint is installed on your machine. Taskfile has a lot of useful features like preconditions, silent mode, includes, and more.
Now you can run the task for Golang:
task golang:build
I would like to invite you to visit the project’s github page at Link You have to practice to understand how Taskfile works and build your own automation scripts or some project.
Summary
In this article, I showed you how to use Taskfile as a modern Makefile alternative. It is alternative to Makefile and it is easier to use and understand. I hope you enjoyed this article and see you next time.