set dotenv-load

_default:
  @just --list

fix:
  #!/usr/bin/env bash
  # Fix markdown formatting with Prettier
  bunx prettier --write "**/*.md" --config ./.prettierrc

  go fix ./...

  go tool gofumpt -l -w .

  go tool golangci-lint run --fix

  git ls-files "*.md" | xargs -r bunx markdownlint-cli2 --fix


check:
  #!/usr/bin/env bash
  set -e

  go tool gofumpt -e -l .

  go tool golangci-lint run

  # Check markdown
  bunx prettier -c "**/*.md" --config ./.prettierrc
  git ls-files "*.md" | xargs -r bunx markdownlint-cli2

install:
  go get -tool mvdan.cc/gofumpt@latest
  go get -tool github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest

test:
  go test ./...

coverage:
  #!/usr/bin/env bash
  set -e
  tmp=$(mktemp)
  go test -coverprofile="$tmp" ./...
  go tool cover -func="$tmp"
  rm -f "$tmp"

generate:
  #!/usr/bin/env bash
  go generate ./...

