Summary
TruncateOutput uses len([]byte(stdout)) and len([]byte(stderr)) to get byte lengths. This allocates a full byte-slice copy of each string. In Go, len(s) already returns the byte count of a string without allocation.
Location
output/output.go:29-30
totalStdout := len([]byte(stdout))
totalStderr := len([]byte(stderr))
Suggested Fix
totalStdout := len(stdout)
totalStderr := len(stderr)
Summary
TruncateOutputuseslen([]byte(stdout))andlen([]byte(stderr))to get byte lengths. This allocates a full byte-slice copy of each string. In Go,len(s)already returns the byte count of a string without allocation.Location
output/output.go:29-30Suggested Fix