qstash-lint
Run Go code quality checks for qstash-stress project.
Quick Check (All)
Run all checks in sequence:
bash
go build ./... && go vet ./... && go test ./... && go test -race ./...
Individual Checks
Build Verification
bash
go build ./...
Verifies code compiles without errors.
Static Analysis (go vet)
bash
go vet ./...
Catches common mistakes:
- •Printf format string mismatches
- •Unreachable code
- •Suspicious constructs
Unit Tests
bash
go test ./...
Runs all tests. For verbose output:
bash
go test -v ./...
Race Detection
bash
go test -race ./...
Detects data races. Critical for this project due to:
- •
sync.Mapusage in tracker - •Atomic operations for counters
- •Per-message
RWMutexlocks - •Concurrent HTTP handlers
Project-Specific Checks
Thread Safety Patterns
Verify these patterns are followed:
- •Tracker counters: Use
atomic.AddInt64,atomic.LoadInt64 - •TrackingInfo access: Always lock with
info.mu.Lock()/info.mu.RLock() - •Metrics samples: Protected by
m.mu.Lock()/m.mu.RLock() - •BehaviorConfig: Protected by
b.mumutex
Common Issues
Unused imports/variables:
bash
go build ./... # Compiler errors will show unused items
Error handling:
Check that io.ReadAll and json.Marshal errors are handled.
Connection reuse:
Ensure drainAndClose(resp.Body) is called on HTTP responses.
Pre-Commit Checklist
- •
go build ./...- Compiles - •
go vet ./...- No warnings - •
go test ./...- All pass - •
go test -race ./...- No races - •Check for
TODOcomments that should be addressed