summaryrefslogtreecommitdiff
path: root/Magefile.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-14 10:43:33 +0300
committerPaul Buetow <paul@buetow.org>2026-04-14 10:43:33 +0300
commit9d32b8138baf821d72eb1f5a7a218f9b1949c853 (patch)
treeecb4884f72d425b63e2f1039bf018732ecfe0598 /Magefile.go
parentaad908c3b71f2a99898e0b0820625ddd40a986f3 (diff)
Enable race tests in mage automation (p3)
- Test runs unit tests then race detector via mg.Deps - Add TestRace target for race-only runs - Document mage test vs testRace in AGENTS.md Made-with: Cursor
Diffstat (limited to 'Magefile.go')
-rw-r--r--Magefile.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/Magefile.go b/Magefile.go
index ac2f23e..742ffbf 100644
--- a/Magefile.go
+++ b/Magefile.go
@@ -23,11 +23,25 @@ func Build() error {
return sh.RunV("go", "build", "-o", binaryName, "./cmd/goprecords")
}
-// Test runs all tests.
+// Test runs all tests with the default race-free pass and again with the race detector.
func Test() error {
+ mg.Deps(testUnit, testRace)
+ return nil
+}
+
+func testUnit() error {
return sh.RunV("go", "test", "./...")
}
+// TestRace runs tests with the race detector (-race).
+func TestRace() error {
+ return testRace()
+}
+
+func testRace() error {
+ return sh.RunV("go", "test", "-race", "./...")
+}
+
// CoverMicroservice runs tests with coverage for daemon, authkeys, and cli, then prints per-function coverage (go tool cover -func).
func CoverMicroservice() error {
profile := filepath.Join(os.TempDir(), "goprecords-microservice.cover")