MCPcopy
hub / github.com/google/go-cmp / formatHex

Function formatHex

cmp/report_reflect.go:393–414  ·  view source on GitHub ↗

formatHex prints u as a hexadecimal integer in Go notation.

(u uint64)

Source from the content-addressed store, hash-verified

391
392// formatHex prints u as a hexadecimal integer in Go notation.
393func formatHex(u uint64) string {
394 var f string
395 switch {
396 case u <= 0xff:
397 f = "0x%02x"
398 case u <= 0xffff:
399 f = "0x%04x"
400 case u <= 0xffffff:
401 f = "0x%06x"
402 case u <= 0xffffffff:
403 f = "0x%08x"
404 case u <= 0xffffffffff:
405 f = "0x%010x"
406 case u <= 0xffffffffffff:
407 f = "0x%012x"
408 case u <= 0xffffffffffffff:
409 f = "0x%014x"
410 case u <= 0xffffffffffffffff:
411 f = "0x%016x"
412 }
413 return fmt.Sprintf(f, u)
414}

Callers 3

FormatDiffSliceMethod · 0.85
formatPointerFunction · 0.85
FormatValueMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…