Skip to content

Commit c9c6223

Browse files
committed
chore: parallelize task runner commands for faster feedback loops
Optimize build, test, generate, lint, format, and vuln-scanning tasks in Taskfile.yaml by executing workspace-aware commands natively and parallelizing multi-module directories with xargs. 💘 Generated with Crush Assisted-by: Crush:gemini-3.5-flash
1 parent def6ae2 commit c9c6223

1 file changed

Lines changed: 11 additions & 53 deletions

File tree

Taskfile.yaml

Lines changed: 11 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,11 @@ env:
66

77
tasks:
88
generate:
9-
cmd: |
10-
go generate ./...
11-
find plugin examples -name go.mod -exec dirname {} \; | while read -r dir; do
12-
echo "Generating code in $dir..."
13-
(cd "$dir" && go generate ./...)
14-
done
9+
cmd: go generate github.com/detro/spelunk/v2/... github.com/detro/spelunk/plugin/... github.com/detro/spelunk/examples/...
1510

1611
build:
1712
deps: [generate]
18-
cmd: |
19-
go build .
20-
find plugin examples -name go.mod -exec dirname {} \; | while read -r dir; do
21-
echo "Building in $dir..."
22-
(cd "$dir" && go build ./...)
23-
done
13+
cmd: go build github.com/detro/spelunk/v2/... github.com/detro/spelunk/plugin/... github.com/detro/spelunk/examples/...
2414

2515
test:
2616
deps: [test.full]
@@ -30,69 +20,45 @@ tasks:
3020
{{if .CLI_ARGS}}
3121
go test -v -race -cover -short {{.CLI_ARGS}}
3222
{{else}}
33-
go test -v -race -cover -short ./...
34-
find plugin -name go.mod -exec dirname {} \; | while read -r dir; do
35-
echo "Testing $dir..."
36-
(cd "$dir" && go test -v -race -cover -short ./...)
37-
done
23+
go test -v -race -cover -short github.com/detro/spelunk/v2/... github.com/detro/spelunk/plugin/...
3824
{{end}}
3925
4026
test.full:
4127
cmd: |
4228
{{if .CLI_ARGS}}
4329
go test -v -race -cover {{.CLI_ARGS}}
4430
{{else}}
45-
go test -v -race -cover ./...
46-
find plugin -name go.mod -exec dirname {} \; | while read -r dir; do
47-
echo "Testing $dir..."
48-
(cd "$dir" && go test -v -race -cover ./...)
49-
done
31+
go test -v -race -cover github.com/detro/spelunk/v2/... github.com/detro/spelunk/plugin/...
5032
{{end}}
5133
5234
test.ci:
5335
cmd: |
5436
{{if .CLI_ARGS}}
5537
go test -v -race -coverprofile=coverage.out -covermode=atomic {{.CLI_ARGS}}
5638
{{else}}
57-
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
58-
find plugin -name go.mod -exec dirname {} \; | while read -r dir; do
59-
echo "Testing $dir..."
60-
(cd "$dir" && go test -v -race -coverprofile=coverage.out -covermode=atomic ./...)
61-
done
39+
go test -v -race -coverprofile=coverage.out -covermode=atomic github.com/detro/spelunk/v2/... github.com/detro/spelunk/plugin/...
6240
{{end}}
6341
6442
lint:
6543
cmd: |
6644
golangci-lint run --allow-parallel-runners --verbose
67-
find plugin -name go.mod -exec dirname {} \; | while read -r dir; do
68-
echo "Linting in $dir..."
69-
(cd "$dir" && golangci-lint run --allow-parallel-runners --verbose)
70-
done
45+
find plugin -name go.mod -exec dirname {} \; | xargs -I {} -P 8 sh -c 'echo "Linting in {}..." && cd {} && golangci-lint run --allow-parallel-runners --verbose'
7146
7247
vuln:
7348
desc: Run govulncheck for vulnerability scanning
7449
cmd: |
7550
govulncheck ./...
76-
find plugin examples -name go.mod -exec dirname {} \; | while read -r dir; do
77-
echo "Scanning vulnerabilities in $dir..."
78-
(cd "$dir" && govulncheck ./...)
79-
done
51+
find plugin examples -name go.mod -exec dirname {} \; | xargs -I {} -P 8 sh -c 'echo "Scanning vulnerabilities in {}..." && cd {} && govulncheck ./...'
8052
8153
lint-fix:
8254
cmd: |
8355
golangci-lint run --fix --allow-parallel-runners --verbose
84-
find plugin -name go.mod -exec dirname {} \; | while read -r dir; do
85-
echo "Fixing linter issues in $dir..."
86-
(cd "$dir" && golangci-lint run --fix --allow-parallel-runners --verbose)
87-
done
56+
find plugin -name go.mod -exec dirname {} \; | xargs -I {} -P 8 sh -c 'echo "Fixing linter issues in {}..." && cd {} && golangci-lint run --fix --allow-parallel-runners --verbose'
8857
8958
fmt:
9059
cmd: |
9160
golangci-lint fmt -v
92-
find plugin -name go.mod -exec dirname {} \; | while read -r dir; do
93-
echo "Formatting in $dir..."
94-
(cd "$dir" && golangci-lint fmt -v)
95-
done
61+
find plugin -name go.mod -exec dirname {} \; | xargs -I {} -P 8 sh -c 'echo "Formatting in {}..." && cd {} && golangci-lint fmt -v'
9662
9763
run:
9864
cmd: go run . {{.CLI_ARGS}}
@@ -101,21 +67,13 @@ tasks:
10167
cmd: |
10268
echo "Updating root module..."
10369
go get -t -u ./...
104-
105-
find plugin examples -name go.mod -exec dirname {} \; | while read -r dir; do
106-
echo "Updating dependencies in $dir..."
107-
(cd "$dir" && go get -t -u ./...)
108-
done
70+
find plugin examples -name go.mod -exec dirname {} \; | xargs -I {} -P 8 sh -c 'echo "Updating dependencies in {}..." && cd {} && go get -t -u ./...'
10971
11072
mod.tidy:
11173
cmd: |
11274
echo "Tidying root module..."
11375
go mod tidy -v
114-
115-
find plugin examples -name go.mod -exec dirname {} \; | while read -r dir; do
116-
echo "Tidying module in $dir..."
117-
(cd "$dir" && go mod tidy -v)
118-
done
76+
find plugin examples -name go.mod -exec dirname {} \; | xargs -I {} -P 8 sh -c 'echo "Tidying module in {}..." && cd {} && go mod tidy -v'
11977
12078
dependencies.update:
12179
deps:

0 commit comments

Comments
 (0)