Summary
describe.WithCallback hardcodes a trailing newline (printf("%s%s\n", ...)), so every consumer of DescribeWithCallback is forced to receive newline-terminated lines. A caller that wants to collect lines into a buffer, feed a logger, or join them with a custom separator cannot control termination.
Location
- File(s):
utils/describe/describe.go
- Line(s) / function(s):
WithCallback()
Category
api-contract
Severity
low
Justification: no runtime defect; this is an API flexibility gap. Line termination is a sink concern but is currently owned by the renderer.
Reproduction / Evidence
Verified by code analysis. WithCallback calls printf("%s%s\n", prefix, line). The \n is appended unconditionally, so a custom Printf sink passed to any type's DescribeWithCallback always receives a terminated line and cannot opt out.
Expected Behavior
WithCallback emits each indented line bare (no trailing newline) and lets the callback decide termination. Describe keeps its current stdout behavior by using a sink that appends the newline.
Actual Behavior
WithCallback appends \n to every line, and Describe relies on that.
Summary
describe.WithCallbackhardcodes a trailing newline (printf("%s%s\n", ...)), so every consumer ofDescribeWithCallbackis forced to receive newline-terminated lines. A caller that wants to collect lines into a buffer, feed a logger, or join them with a custom separator cannot control termination.Location
utils/describe/describe.goWithCallback()Category
api-contractSeverity
lowJustification: no runtime defect; this is an API flexibility gap. Line termination is a sink concern but is currently owned by the renderer.
Reproduction / Evidence
Verified by code analysis.
WithCallbackcallsprintf("%s%s\n", prefix, line). The\nis appended unconditionally, so a customPrintfsink passed to any type'sDescribeWithCallbackalways receives a terminated line and cannot opt out.Expected Behavior
WithCallbackemits each indented line bare (no trailing newline) and lets the callback decide termination.Describekeeps its current stdout behavior by using a sink that appends the newline.Actual Behavior
WithCallbackappends\nto every line, andDescriberelies on that.