Exported os/exec.prefixSuffixSaver.
// Saver is an io.Writer which retains the first N bytes
// and the last N bytes written to it. The Bytes() methods reconstructs
// it with a pretty error message.
type Saver struct {
N int // max size of prefix or suffix
// ...
}
func something() {
s := &prefixsuffix.Saver{N: 4}
io.WriteString(s, "1234 --- 5678")
fmt.Printf("%s\n", s.Bytes())
// 1234
// ... omitting 5 bytes ...
// 5678
}