value

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2018 License: BSD-3-Clause Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package value provides functionality for reflect.Value types.

Index

Constants

This section is empty.

Variables

This section is empty.

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

func SortKeys(vs []reflect.Value) []reflect.Value

SortKeys sorts a list of map keys, deduplicating keys if necessary. The type of each value must be comparable.

Types

type FormatConfig added in v0.2.0

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL