From efa86a6e22033339e9a76f9df83abb1ad249adb5 Mon Sep 17 00:00:00 2001 From: juancwu Date: Sat, 25 Apr 2026 18:58:23 +0000 Subject: [PATCH] update readme and taskfile --- README.md | 20 ++++++++++++++++++++ Taskfile.yml | 43 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 788a1ab..1ecb725 100644 --- a/README.md +++ b/README.md @@ -60,3 +60,23 @@ if errors.As(err, &e) { log.Printf("op=%s", e.Op) } ``` + +## Development + +This repo uses [Task](https://taskfile.dev) as its task runner. After cloning: + +```bash +task install:tools # installs github.com/mfridman/tparse +task # vet + tests +``` + +Common targets: + +| Task | What it does | +| ----------------- | ------------------------------------- | +| `task` | `vet` + `test` (the default) | +| `task test` | `go test ./...` piped through tparse | +| `task test:race` | tests under the race detector | +| `task vet` | `go vet ./...` | +| `task fmt` | `gofmt -w .` | +| `task tidy` | `go mod tidy` | diff --git a/Taskfile.yml b/Taskfile.yml index a34a2fd..89710eb 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -1,6 +1,43 @@ version: '3' + tasks: - test: - desc: Run tests + default: + desc: Run vet and tests cmds: - - set -o pipefail && go test fmt -json | tparse -all + - task: check + + install:tools: + desc: Install development tools (tparse for prettier test output) + cmds: + - go install github.com/mfridman/tparse@latest + + test: + desc: Run tests with prettier output via tparse + cmds: + - set -o pipefail && go test ./... -json -cover | tparse -all + + test:race: + desc: Run tests under the race detector + cmds: + - set -o pipefail && go test ./... -race -json | tparse -all + + vet: + desc: Run go vet + cmds: + - go vet ./... + + fmt: + desc: Format Go source files + cmds: + - gofmt -w . + + tidy: + desc: Tidy go.mod + cmds: + - go mod tidy + + check: + desc: Run vet and tests + cmds: + - task: vet + - task: test