Skip to content

Commit

Permalink
assert: reduce memory allocations in indentMessageLines
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunmahishi committed Apr 4, 2024
1 parent b83d206 commit 9e31964
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion assert/assertions.go
Expand Up @@ -308,7 +308,7 @@ func indentMessageLines(message string, longestLabelLen int) string {
// than the length of the message to avoid exceeding the default
// MaxScanTokenSize while scanning lines. This can happen when there is a
// single very long line. Refer to issue #1525
msgScanner.Buffer(nil, len(message)+1)
msgScanner.Buffer(make([]byte, len(message)+1), len(message)+1)

isFirstLine := true
indent := fmt.Sprintf("\n\t%*s\t", longestLabelLen+1, "")
Expand Down

0 comments on commit 9e31964

Please sign in to comment.