chore(taskfile): avoid compiling when not needed

Andrey Nering created

Change summary

.gitignore    | 1 +
Taskfile.yaml | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletion(-)

Detailed changes

.gitignore 🔗

@@ -50,3 +50,4 @@ Thumbs.db
 manpages/
 completions/crush.*sh
 .prettierignore
+.task

Taskfile.yaml 🔗

@@ -46,8 +46,11 @@ tasks:
       LDFLAGS: '{{if .VERSION}}-ldflags="-X github.com/charmbracelet/crush/internal/version.Version={{.VERSION}}"{{end}}'
     cmds:
       - "go build {{if .RACE}}-race{{end}} {{.LDFLAGS}} ."
+    sources:
+      - ./**/*.go
+      - go.mod
     generates:
-      - crush
+      - crush{{exeExt}}
 
   run:
     desc: Run build
@@ -91,6 +94,9 @@ tasks:
     cmds:
       - task: fetch-tags
       - go install {{.LDFLAGS}} -v .
+    sources:
+      - ./**/*.go
+      - go.mod
 
   profile:cpu:
     desc: 10s CPU profile