From 541fe26ddb20e00112d0bcbda9249625dfe5d245 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 25 Jun 2026 11:10:52 +0300 Subject: Fix gofmt and errcheck guardrails for task 2r0 --- Magefile.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'Magefile.go') 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...") -- cgit v1.2.3