Repository navigation
Send fmt.Fprintln to the writer it is given - #216
Conversation
fmt.Fprintln(w, ...) printed to stdout for every w but a strings.Builder
and os.Stderr: a type with its own Write, a bytes.Buffer, a bufio.Writer
and an io.Writer parameter all lost the line, and it showed on the
terminal instead. Fprint and Fprintf already wrote to these writers.
Fprintln now takes the same paths.
Also:
- Fprintln(w, args...) and Fprint(w, args...) with args a []any printed
the slice as one value. They now print its elements, as Println(args...)
does.
- A field of the method's receiver in a []any literal, []any{l.prefix},
was boxed as the field's cell, and printing it panicked ("cannot print
this value held in an interface"). It is boxed as its value.
Fixtures: fprintln_writers covers a type with its own Write, a
bytes.Buffer, a bufio.Writer, an io.Writer parameter and os.Stdout;
fprintln_writers_plain covers a writer, Fprintln's (int, error), a
logger whose value receiver spreads []any{prefix, args...}, and
Fprint(w, args...). Both match Go. No other snapshot changes. The ratchet
is unchanged.
Agent: claude-chat
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TkCXVghVg3khqYkpQSWyEM
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 1 minute. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Sorry @tylerlaprade, this account has used its review budget of 1,500,000 diff characters for the last 7 days. You can request another review in 1 day and 13 hours by commenting |
Reviewer's GuideImplementationRoute Fprintln through the writer paths used by Fprint and Fprintf, and format spread []any arguments as individual operands.
Detect receiver field selectors and box their owned value rather than the field cell when building interface slices.
TestsAdd focused transpiler regressions for writer-directed Fprintln, spread arguments, and receiver-field boxing.
Add end-to-end fixtures covering custom and standard writers, return values, interface-slice spreads, and expected output.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Fixes DEV-161.
fmt.Fprintln(w, ...)printed to stdout for everywexcept astrings.Builderandos.Stderr:A type with its own
Write, abytes.Buffer, abufio.Writerand anio.Writerparameter all lost the line.FprintandFprintfalready wrote to these writers.Fprintlnnow takes the same paths, and returns the same(int, error).Two more bugs, found in the same probe:
fmt.Fprintln(w, args...),fmt.Fprint(w, args...)withargs []anyPrintln(args...)does[]any{l.prefix}in a method oflFixtures:
fprintln_writers: a type with its ownWrite, abytes.Buffer, abufio.Writer, anio.Writerparameter, andos.Stdout.fprintln_writers_plain: a program that needs no shared-state wrappers. It covers a writer,Fprintln's(int, error), a logger whose value receiver spreads[]any{prefix, args...}, andFprint(w, args...).Both match Go. No other snapshot changes. The ratchet is unchanged.
Not covered: writing to a file from
os.Createdoes not compile at all on master. That is DEV-150, in the next PR.— agent: claude-chat
Generated by Claude Code
Summary by Sourcery
Route fmt.Fprintln consistently to its supplied writer and align variadic interface formatting with Go behavior.
Bug Fixes:
Tests: