File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -141,8 +141,8 @@ func takeStacktrace(skip int) string {
141141
142142// stackFormatter formats a stack trace into a readable string representation.
143143type stackFormatter struct {
144- i int // number of frames already written
145- b * buffer. Buffer
144+ b * buffer. Buffer
145+ nonEmpty bool // whehther we've written at least one frame already
146146}
147147
148148// newStackFormatter builds a new stackFormatter.
@@ -163,10 +163,10 @@ func (sf *stackFormatter) FormatStack(stack *stacktrace) {
163163
164164// FormatFrame formats the given frame.
165165func (sf * stackFormatter ) FormatFrame (frame runtime.Frame ) {
166- if sf .i != 0 {
166+ if sf .nonEmpty {
167167 sf .b .AppendByte ('\n' )
168168 }
169- sf .i ++
169+ sf .nonEmpty = true
170170 sf .b .AppendString (frame .Function )
171171 sf .b .AppendByte ('\n' )
172172 sf .b .AppendByte ('\t' )
You can’t perform that action at this time.
0 commit comments