Skip to content

Make describe.WithCallback emit bare lines and move newline termination to the sink #127

Description

@p0dalirius

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions