summaryrefslogtreecommitdiff
path: root/Magefile.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-04 09:11:30 +0200
committerPaul Buetow <paul@buetow.org>2026-02-04 09:11:30 +0200
commit288aa24e8bc4f22cb7de5d60789e1d6ec79f7395 (patch)
treebe644130fbffaf946e3122ffdf89dc203447124a /Magefile.go
parent6d8953d52efa6037b679d7a722b060c687843f3a (diff)
add runtime debugging signals and convert to magev0.10.0
- Add SIGUSR1 handler for goroutine stack dumps when app hangs - Add SIGUSR2 handler for full profiling (heap, cpu, block) - Add --debug-dir flag for configurable debug output location - Convert build system from go-task to mage - Update documentation with debugging workflow - Bump version to 0.10.0
Diffstat (limited to 'Magefile.go')
-rw-r--r--Magefile.go53
1 files changed, 53 insertions, 0 deletions
diff --git a/Magefile.go b/Magefile.go
new file mode 100644
index 0000000..b4b5ecc
--- /dev/null
+++ b/Magefile.go
@@ -0,0 +1,53 @@
+//go:build mage
+// +build mage
+
+package main
+
+import (
+ "fmt"
+ "os"
+
+ "github.com/magefile/mage/sh"
+)
+
+// Default target builds the tasksamurai binary
+func Default() error {
+ return Build()
+}
+
+// Build compiles the tasksamurai binary
+func Build() error {
+ fmt.Println("Building tasksamurai...")
+ return sh.Run("go", "build", "-o", "tasksamurai", "./cmd/tasksamurai")
+}
+
+// Run starts tasksamurai with any provided arguments
+func Run() error {
+ fmt.Println("Running tasksamurai...")
+ args := append([]string{"run", "./cmd/tasksamurai"}, os.Args[1:]...)
+ return sh.Run("go", args...)
+}
+
+// Test runs all tests
+func Test() error {
+ fmt.Println("Running tests...")
+ return sh.Run("go", "test", "./...")
+}
+
+// Install installs tasksamurai to $GOPATH/bin
+func Install() error {
+ fmt.Println("Installing tasksamurai...")
+ return sh.Run("go", "install", "./cmd/tasksamurai")
+}
+
+// Clean removes the built binary
+func Clean() error {
+ fmt.Println("Cleaning...")
+ if err := sh.Rm("tasksamurai"); err != nil {
+ // Ignore error if file doesn't exist
+ if !os.IsNotExist(err) {
+ return err
+ }
+ }
+ return nil
+}