refactor: Use IOStreams for command output instead of os.Stdout and log#372
refactor: Use IOStreams for command output instead of os.Stdout and log#372kaizakin wants to merge 1 commit intoshipwright-io:mainfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
c0b2e22 to
bfe75a8
Compare
There was a problem hiding this comment.
Pull request overview
This PR standardizes user-facing CLI output by routing it through Kubernetes IOStreams (instead of writing directly to os.Stdout / fmt.Printf / log.Printf), aligning subcommands with the CLI’s existing stream-injection pattern.
Changes:
- Update
versionsubcommand to acceptIOStreamsand write toioStreams.Out. - Switch multiple
listsubcommands’ tabwriter output fromos.Stdouttoio.Out. - Replace
log.Printf/os.Stdoutoutput inbuild uploadwithfmt.Fprintf(ioStreams.Out, ...)and thread streams through helpers.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/shp/cmd/version/version.go | Accepts IOStreams and writes version output to ioStreams.Out. |
| pkg/shp/cmd/root.go | Passes ioStreams into the version command constructor. |
| pkg/shp/cmd/clusterbuildstrategy/list.go | Writes tabular list output to io.Out instead of os.Stdout. |
| pkg/shp/cmd/buildstrategy/list.go | Writes tabular list output to io.Out instead of os.Stdout. |
| pkg/shp/cmd/buildrun/list.go | Writes tabular list output to io.Out instead of os.Stdout. |
| pkg/shp/cmd/build/upload.go | Uses IOStreams for user-facing progress/info output during buildrun creation and streaming. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: karthik balasubramanian <karthikbalasubramanian08@gmail.com>
Changes
Fixes #90
The original issue was about inconsistent user facing logging.
Turns out 95% of the codebase is already following the best practice as the same as kubectl.
Following @IrvingMg's suggestion,
I've updated some inconsistencies to follow the same structure as the rest of the commands.
/kind feature
Submitter Checklist
See the contributor guide
for details on coding conventions, github and prow interactions, and the code review process.
Release Notes