MCPcopy Index your code
hub / github.com/google/gopacket / LongBytesGoString

Function LongBytesGoString

packet.go:323–330  ·  view source on GitHub ↗

LongBytesGoString returns a string representation of the byte slice shortened using the format ' { ... ( bytes)}' if it exceeds a predetermined length. Can be used to avoid filling the display with very long byte strings.

(buf []byte)

Source from the content-addressed store, hash-verified

321// exceeds a predetermined length. Can be used to avoid filling the display with
322// very long byte strings.
323func LongBytesGoString(buf []byte) string {
324 if len(buf) < longBytesLength {
325 return fmt.Sprintf("%#v", buf)
326 }
327 s := fmt.Sprintf("%#v", buf[:longBytesLength-1])
328 s = strings.TrimSuffix(s, "}")
329 return fmt.Sprintf("%s ... (%d bytes)}", s, len(buf))
330}
331
332func baseLayerString(value reflect.Value) string {
333 t := value.Type()

Callers 3

GoStringMethod · 0.85
baseLayerStringFunction · 0.85

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…