diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-25 11:10:52 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-25 11:10:52 +0300 |
| commit | 541fe26ddb20e00112d0bcbda9249625dfe5d245 (patch) | |
| tree | 5f81675f24bfbb0dc9256cfdf8ce70b319c7fd35 /Magefile.go | |
| parent | f3b64f706e2df8ceffafdef916a127e8e22c296b (diff) | |
Fix gofmt and errcheck guardrails for task 2r0
Diffstat (limited to 'Magefile.go')
| -rw-r--r-- | Magefile.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Magefile.go b/Magefile.go index b4b5ecc..1f4f1cc 100644 --- a/Magefile.go +++ b/Magefile.go @@ -6,6 +6,7 @@ package main import ( "fmt" "os" + "strings" "github.com/magefile/mage/sh" ) @@ -34,6 +35,25 @@ func Test() error { return sh.Run("go", "test", "./...") } +// Verify runs formatting and static checks before tests. +func Verify() error { + fmt.Println("Checking gofmt...") + out, err := sh.Output("gofmt", "-l", ".") + if err != nil { + return err + } + if strings.TrimSpace(out) != "" { + return fmt.Errorf("gofmt needed for:\n%s", out) + } + + fmt.Println("Running errcheck...") + if err := sh.Run("errcheck", "./..."); err != nil { + return err + } + + return Test() +} + // Install installs tasksamurai to $GOPATH/bin func Install() error { fmt.Println("Installing tasksamurai...") |
