Skip to content

fix: omit leading newline when formatting StackTrace with %+v#250

Open
Solaris-star wants to merge 1 commit into
pkg:masterfrom
Solaris-star:fix/230-stacktrace-format-leading-newline
Open

fix: omit leading newline when formatting StackTrace with %+v#250
Solaris-star wants to merge 1 commit into
pkg:masterfrom
Solaris-star:fix/230-stacktrace-format-leading-newline

Conversation

@Solaris-star

Copy link
Copy Markdown

Summary

fmt.Sprintf("%+v", stackTrace) prefixed every frame with a newline, including the first one. That made a bare StackTrace print with a leading blank line (#230).

Fix

In StackTrace.Format for %+v, write a newline only between frames (not before the first). Error formatting is unchanged because stack.Format still prefixes each frame with \n after the message.

Test plan

  • go test -vet=off .
  • Updated TestStackTraceFormat expectation
  • New TestStackTraceFormatNoLeadingNewline

Fixes #230

@puellanivis

Copy link
Copy Markdown

This is intended behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StackTrace.Format with "%+v" includes a leading newline

2 participants