Skip to main content

Overview

RTK provides comprehensive Go development tool support with 80-90% token savings through:
  • NDJSON streaming: Line-by-line parsing of go test -json
  • Error-only filtering: Show only build/vet errors
  • JSON grouping: Structured golangci-lint output
  • Package tracking: Handle multiple packages in parallel

Supported Tools

go test

Test runner with NDJSON parsing (90% savings)

go build

Build errors only (80% savings)

go vet

Static analysis issues (75% savings)

golangci-lint

Comprehensive linting (85% savings)

rtk go test

Go test runner with NDJSON streaming parser.

Usage

Examples

Features

  • NDJSON parsing: Parses go test -json output line-by-line
  • Streaming: Handles interleaved events from multiple packages
  • Failure details: Preserves test output and error messages
  • Build errors: Captures compilation failures separately
  • Tee recovery: Full output saved to file on failure

Implementation

From src/go_cmd.rs:run_test():

NDJSON Event Stream

Go test outputs NDJSON (newline-delimited JSON) for structured parsing:
RTK parses each line independently, allowing streaming output.

Supported Flags

  • -v: Verbose (passthrough)
  • -run <regexp>: Run tests matching pattern
  • -short: Run short tests only
  • -timeout <duration>: Test timeout
  • -race: Enable race detector
  • -cover: Enable coverage

Example: Specific Package

Example: With Flags

rtk go build

Go build showing errors only.

Usage

Examples

Features

  • Error-only: Show compilation errors, hide success messages
  • File locations: Preserve file:line:column references
  • Tee recovery: Full output saved on failure
  • Exit codes: Preserves build failure codes

Implementation

From src/go_cmd.rs:run_build():

rtk go vet

Go vet static analysis showing issues only.

Usage

Examples

Features

  • Issue-only: Show vet warnings/errors, hide success
  • File locations: Preserve file:line:column
  • Exit codes: Fails if issues found

rtk golangci-lint

Golangci-lint with JSON parsing and rule grouping.

Usage

Examples

Features

  • JSON parsing: Uses --out-format=json automatically
  • Linter grouping: Groups issues by linter name
  • File locations: Compact file:line format
  • Exit codes: Safe for CI/CD

Implementation

From src/golangci_cmd.rs:

Supported Options

  • --enable-all: Enable all linters
  • --disable <linter>: Disable specific linter
  • --fix: Auto-fix issues
  • --config <file>: Use custom config

Package Handling

All Go commands support multiple packages:

Build Tags

Go commands respect build tags:

CI/CD Integration

All Go commands preserve exit codes:

Token Savings Summary

Performance Notes

NDJSON Streaming

RTK parses go test -json output line-by-line, enabling:
  • Memory efficiency: No buffering entire output
  • Real-time processing: Incremental parsing as tests run
  • Scalability: Handles large test suites with many packages

Package Parallelization

go test runs packages in parallel. RTK tracks results per package:

Next Steps

Testing

Cross-language test runners

GitHub

GitHub PR/issue management