How to Use Task (Taskfile.yml) as a Make Alternative for Go

Use Task with a Taskfile.yml to define and run Go project commands like build and test as a simpler alternative to Make.

Task is a task runner that uses a YAML file named Taskfile.yml to define commands, replacing the need for a Makefile and the make command. Create a Taskfile.yml in your project root with a version key and a tasks map containing your commands, then run them using the task CLI tool.

version: '3'
tasks:
  build:
    cmds:
      - go build -o bin/app ./cmd/app
  test:
    cmds:
      - go test -v ./...
  clean:
    cmds:
      - rm -rf bin/

Run a task with task <taskname>, for example task build or task test.