refactor: separate printer functionality into dedicated module#40
Merged
Conversation
- Extract all result printing logic from client.go into printer.go - Create Printer struct with configurable io.Writer for better testability - Move PrintStatHeader, PrintStatLine, PrintReport, and PrintJSONLinesReport methods - Move JSONLinesResult struct to printer module - Update all callers to use new Printer interface - Add comprehensive unit tests in printer_test.go covering all methods and edge cases - Maintain backwards compatibility with existing functionality - Improve separation of concerns and code maintainability 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Move toMicroseconds and toMicrosecondsf helper functions from client.go to printer.go - These functions are only used by the printer module for latency calculations - Add missing newline at end of printer.go file 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
New files:
printer.go- Contains Printer struct and all printing methodsprinter_test.go- Comprehensive unit tests for printer functionalityModified files:
client.go- Removed printing functions, updated to use new Printermain.go- Updated to use new Printer interfaceclient_test.go,e2e_test.go,jsonlines_test.go- Updated to use new PrinterBenefits
Test plan
🤖 Generated with Claude Code