Skip to content

Commit b429e47

Browse files
ajitpratap0Ajit Pratap Singhclaude
authored
build: replace Make with go-task for modern task running (#131)
* build: replace Make with go-task for modern task running Replace the 69-line Makefile with a comprehensive Taskfile.yml (420+ lines) using go-task (https://taskfile.dev) for better task organization and features. New capabilities added: - 45+ tasks vs original 10 Makefile targets - Task namespacing (build:cli, test:race, lint:fix, etc.) - Cross-platform builds (linux, darwin, windows / amd64, arm64) - CPU and memory profiling support - Fuzz testing integration - Security scanning (govulncheck) - LSP server commands - CI/CD pipeline tasks - Release management with goreleaser - Development watch mode - Parameterized tasks (PKG, SQL, FUZZ_TIME variables) Documentation updated: - CLAUDE.md: Updated all build/test commands to use task - README.md: Added Task runner prerequisites and updated commands Install task with: go install github.com/go-task/task/v3/cmd/task@latest 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * docs: update all documentation references from Make to Task Update remaining Make/Makefile references across documentation: - CONTRIBUTING.md: Update prerequisites, hooks installation commands, and PR checklist to use task commands - scripts/install-hooks.sh: Update hint message from 'make fmt' to 'task fmt' - docs/CLI_GUIDE.md: Replace Makefile example with Taskfile.yml example for build tools integration - docs/PRODUCTION_GUIDE.md: Update build tools reference to Task 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: address review comments for Taskfile.yml Fixes based on code review feedback: 1. Add error handling to lint:fix task - now checks if golangci-lint is installed before running, with helpful installation message 2. Add watchexec installation info to deps:tools - users are now informed about optional watchexec for 'task dev' watch mode 3. Add script existence checks: - hooks:install: validates scripts/install-hooks.sh exists - fuzz: validates scripts/run_fuzz_tests.sh exists - security:validate: validates scripts/validate-security-setup.sh exists 4. Add error handling for release tasks: - release:dry: checks for goreleaser installation - release:check: checks for goreleaser installation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Ajit Pratap Singh <ajitpratapsingh@Ajits-Mac-mini.local> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2ef82ea commit b429e47

8 files changed

Lines changed: 613 additions & 149 deletions

File tree

CLAUDE.md

Lines changed: 80 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -48,85 +48,115 @@ The codebase uses extensive object pooling for performance optimization:
4848

4949
## Development Commands
5050

51+
This project uses [Task](https://taskfile.dev) as the task runner. Install with:
52+
```bash
53+
go install github.com/go-task/task/v3/cmd/task@latest
54+
# Or: brew install go-task (macOS)
55+
```
56+
5157
### Building and Testing
5258
```bash
53-
# Build the project
54-
make build
55-
go build -v ./...
59+
# Show all available tasks
60+
task
61+
62+
# Build all packages
63+
task build
5664

57-
# Build the CLI tool
58-
go build -o gosqlx ./cmd/gosqlx
65+
# Build the CLI binary
66+
task build:cli
67+
68+
# Build CLI for all platforms
69+
task build:cli:all
70+
71+
# Install CLI globally
72+
task install
5973

6074
# Run all tests
61-
make test
62-
go test -v ./...
75+
task test
6376

64-
# Run a single test by pattern
65-
go test -v -run TestTokenizer_SimpleSelect ./pkg/sql/tokenizer/
66-
go test -v -run TestParser_.*Window.* ./pkg/sql/parser/
77+
# Run tests with race detection (CRITICAL)
78+
task test:race
6779

68-
# Run tests for specific packages
69-
go test -v ./pkg/sql/tokenizer/
70-
go test -v ./pkg/sql/parser/
71-
go test -v ./pkg/sql/ast/
72-
go test -v ./pkg/models/
73-
go test -v ./pkg/errors/
80+
# Run tests for specific package
81+
task test:pkg PKG=./pkg/sql/parser
82+
83+
# Run tests in short mode
84+
task test:short
7485

7586
# Run tests with coverage report
76-
make coverage
77-
go test -cover -coverprofile=coverage.out ./...
78-
go tool cover -html=coverage.out -o coverage.html
87+
task coverage
7988

80-
# Generate text coverage report for specific package
81-
go test -coverprofile=coverage.out ./pkg/models/
82-
go tool cover -func=coverage.out
89+
# Show coverage by function
90+
task coverage:func
8391

8492
# Run benchmarks
85-
go test -bench=. -benchmem ./...
86-
go test -bench=BenchmarkTokenizer -benchmem ./pkg/sql/tokenizer/
87-
go test -bench=BenchmarkParser -benchmem ./pkg/sql/parser/
93+
task bench
94+
95+
# Run benchmarks with CPU profiling
96+
task bench:cpu
97+
98+
# Run fuzz tests
99+
task fuzz
88100
```
89101

90102
### Code Quality
91103
```bash
92104
# Format code
93-
make fmt
94-
go fmt ./...
105+
task fmt
106+
107+
# Check formatting (fails if not formatted)
108+
task fmt:check
109+
110+
# Run go vet
111+
task vet
112+
113+
# Run golangci-lint
114+
task lint
95115

96-
# Vet code
97-
make vet
98-
go vet ./...
116+
# Run golangci-lint with auto-fix
117+
task lint:fix
99118

100-
# Run linting (requires golint installation)
101-
make lint
102-
golint ./...
119+
# Run staticcheck
120+
task staticcheck
103121

104-
# Run all quality checks
105-
make quality
122+
# Run all quality checks (fmt, vet, lint)
123+
task quality
124+
125+
# Full check suite (format, vet, lint, test:race)
126+
task check
106127

107128
# CRITICAL: Always run race detection during development
108-
go test -race ./...
109-
go test -race -benchmem ./...
110-
go test -race -timeout 30s ./pkg/...
129+
task test:race
111130
```
112131

113-
### Running Examples
132+
### Security
133+
```bash
134+
# Run security vulnerability scan
135+
task security:scan
136+
137+
# Validate security setup
138+
task security:validate
139+
```
140+
141+
### CI/CD
114142
```bash
115-
# Basic example (demonstrates tokenization and parsing)
116-
cd examples/cmd/
117-
go run example.go
143+
# Run full CI pipeline
144+
task ci
118145

119-
# SQL validator example
120-
cd examples/sql-validator/
121-
go run main.go
146+
# Quick CI check (no race detection)
147+
task ci:quick
148+
```
122149

123-
# SQL formatter example
124-
cd examples/sql-formatter/
125-
go run main.go
150+
### Running Examples
151+
```bash
152+
# Run basic example
153+
task examples
126154

127155
# Run example tests
128-
cd examples/cmd/
129-
go test -v example_test.go
156+
task examples:test
157+
158+
# Or run directly:
159+
go run ./examples/cmd/example.go
130160
```
131161

132162
### CLI Tool Usage (v1.4.0+)

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ GoSQLX aims to be the **fastest, most reliable, and most comprehensive SQL parsi
3838
### Prerequisites
3939
- **Go 1.19+** (latest stable version recommended)
4040
- **Git** for version control
41-
- **Make** for build automation (optional)
41+
- **Task** for task automation (optional) - Install with `go install github.com/go-task/task/v3/cmd/task@latest`
4242

4343
### Getting Started
4444
```bash
@@ -60,7 +60,7 @@ go test ./...
6060
go test -race ./...
6161

6262
# 7. Install Git hooks (RECOMMENDED)
63-
make install-hooks
63+
task hooks:install
6464
# or
6565
./scripts/install-hooks.sh
6666
```
@@ -70,8 +70,8 @@ make install-hooks
7070
GoSQLX provides pre-commit hooks to catch code quality issues before they reach CI/CD:
7171

7272
```bash
73-
# Install hooks using Make
74-
make install-hooks
73+
# Install hooks using Task
74+
task hooks:install
7575

7676
# Or run the script directly
7777
./scripts/install-hooks.sh
@@ -393,7 +393,7 @@ Many applications use PostgreSQL's JSON features extensively...
393393
## 📋 Pull Request Checklist
394394

395395
### Before Submitting
396-
- [ ] **Git Hooks**: Pre-commit hooks installed and passing (`make install-hooks`)
396+
- [ ] **Git Hooks**: Pre-commit hooks installed and passing (`task hooks:install`)
397397
- [ ] **Tests**: All tests pass with `go test -race ./...`
398398
- [ ] **Coverage**: New code has >95% test coverage
399399
- [ ] **Performance**: No performance regression

Makefile

Lines changed: 0 additions & 69 deletions
This file was deleted.

README.md

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -691,39 +691,62 @@ GoSQLX/
691691
### Prerequisites
692692

693693
- Go 1.19+
694-
- Make (optional, for Makefile targets)
695-
- golint, staticcheck (for code quality)
694+
- [Task](https://taskfile.dev) - task runner (install: `go install github.com/go-task/task/v3/cmd/task@latest`)
695+
- golangci-lint, staticcheck (for code quality, install: `task deps:tools`)
696+
697+
### Task Runner
698+
699+
This project uses [Task](https://taskfile.dev) as the task runner. Install with:
700+
```bash
701+
go install github.com/go-task/task/v3/cmd/task@latest
702+
# Or: brew install go-task (macOS)
703+
```
696704

697705
### Building
698706

699707
```bash
708+
# Show all available tasks
709+
task
710+
700711
# Build the project
701-
make build
712+
task build
702713

703-
# Run quality checks
704-
make quality
714+
# Build the CLI binary
715+
task build:cli
716+
717+
# Install CLI globally
718+
task install
719+
720+
# Run all quality checks
721+
task quality
705722

706723
# Run all tests
707-
make test
724+
task test
725+
726+
# Run tests with race detection (recommended)
727+
task test:race
708728

709729
# Clean build artifacts
710-
make clean
730+
task clean
711731
```
712732

713733
### Code Quality
714734

715735
```bash
716736
# Format code
717-
go fmt ./...
737+
task fmt
738+
739+
# Run go vet
740+
task vet
718741

719-
# Vet code
720-
go vet ./...
742+
# Run golangci-lint
743+
task lint
721744

722-
# Run linter
723-
golint ./...
745+
# Run all quality checks (fmt, vet, lint)
746+
task quality
724747

725-
# Static analysis
726-
staticcheck ./...
748+
# Full CI check (format, vet, lint, test:race)
749+
task check
727750
```
728751

729752
## 🤝 Contributing

0 commit comments

Comments
 (0)