package value
import "github.com/google/go-cmp/cmp/internal/value"
Package value provides functionality for reflect.Value types.
Index ¶
- func Format(v reflect.Value, conf FormatConfig) string
- func SortKeys(vs []reflect.Value) []reflect.Value
- type FormatConfig
Functions ¶
func Format ¶
func Format(v reflect.Value, conf FormatConfig) string
Format formats the value v as a string.
This is similar to fmt.Sprintf("%+v", v) except this:
- Prints the type unless it can be elided
- Avoids printing struct fields that are zero
- Prints a nil-slice as being nil, not empty
- Prints map entries in deterministic order
func SortKeys ¶
SortKeys sorts a list of map keys, deduplicating keys if necessary. The type of each value must be comparable.
Types ¶
type FormatConfig ¶
type FormatConfig struct { UseStringer bool // Should the String method be used if available? PrintPrimitiveType bool // Should we print the type of primitives? // contains filtered or unexported fields }
Source Files ¶
- Version
- v0.2.0
- Published
- Feb 2, 2018
- Platform
- js/wasm
- Imports
- 7 packages
- Last checked
- 3 days ago –
Tools for package owners.