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

Function formatMapKey

cmp/report_reflect.go:359–370  ·  view source on GitHub ↗

formatMapKey formats v as if it were a map key. The result is guaranteed to be a single line.

(v reflect.Value, disambiguate bool, ptrs *pointerReferences)

Source from the content-addressed store, hash-verified

357// formatMapKey formats v as if it were a map key.
358// The result is guaranteed to be a single line.
359func formatMapKey(v reflect.Value, disambiguate bool, ptrs *pointerReferences) string {
360 var opts formatOptions
361 opts.DiffMode = diffIdentical
362 opts.TypeMode = elideType
363 opts.PrintAddresses = disambiguate
364 opts.AvoidStringer = disambiguate
365 opts.QualifiedNames = disambiguate
366 opts.VerbosityLevel = maxVerbosityPreset
367 opts.LimitVerbosity = true
368 s := opts.FormatValue(v, reflect.Map, ptrs).String()
369 return strings.TrimSpace(s)
370}
371
372// formatString prints s as a double-quoted or backtick-quoted string.
373func formatString(s string) string {

Callers 2

formatDiffListMethod · 0.85
FormatValueMethod · 0.85

Calls 2

FormatValueMethod · 0.95
StringMethod · 0.65

Tested by

no test coverage detected