# https://taskfile.dev

# This Task file uses relative paths and expects to be located in the root of the dupers repository.
version: '3'

tasks:
  default:
    silent: true
    desc: list all available tasks
    cmds:
     - task --list-all
  lint:
    silent: false
    desc: runs the go formatter and lints the source code
    ignore_error: true
    cmds:
      - cmd: clear
        platforms: [linux,darwin]
      - cmd: gofumpt -w .
      - cmd: golangci-lint run
  build:
    desc: there is no build command, it is done via github actions
  build-race:
    silent: false
    desc: build a binary of this program with the race detection
    cmds:
      - cmd: go build -v -race -o df2 main.go
        platforms: [linux,darwin]
      - cmd: go build -v -race -o df2.exe main.go
        platforms: [windows]
      - cmd: ./df2 --version
        platforms: [linux,darwin]
      - cmd: ./df2.exe --version
        platforms: [windows]
  build-sim:
    silent: false
    desc: build the distribution package for this program by simulating a release
    cmds:
      - cmd: goreleaser release --clean --snapshot
      - cmd: ./dist/df2_linux_amd64_v1/df2 --version
        platforms: [linux/amd64]
  pkg-patch:
    silent: false
    desc: patch the package deependencies
    cmds:
      - cmd: go get -u=patch -x
      - cmd: go mod verify
  pkg-update:
    silent: false
    desc: update the package deependencies
    cmds:
      - cmd: go get -u -x
      - cmd: go mod verify
  ver:
    silent: false
    desc: print the versions of tools
    ignore_error: true
    cmds:
      - cmd: go version
      - cmd: gofumpt --version
      - cmd: task --version
      - cmd: golangci-lint --version
      - cmd: goreleaser --version