Documentation ¶
Overview ¶
Package repr attempts to represent Go values in a form that can be copy-and-pasted into source code directly.
Some values (such as pointers to basic types) can not be represented directly in Go. These values will be output as `&<value>`. eg. `&23`
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Default = New(os.Stdout, Indent(" "))
Default prints to os.Stdout with two space indentation.
Functions ¶
Types ¶
type Option ¶
type Option func(o *Printer)
An Option modifies the default behaviour of a Printer.
func AlwaysIncludeType ¶
func AlwaysIncludeType() Option
AlwaysIncludeType always includes explicit type information for each item.
func ExplicitTypes ¶
ExplicitTypes adds explicit typing to slice and map struct values that would normally be inferred by Go.
func IgnoreGoStringer ¶
func IgnoreGoStringer() Option
IgnoreGoStringer disables use of the .GoString() method.
func IgnorePrivate ¶ added in v0.3.0
func IgnorePrivate() Option
IgnorePrivate disables private field members from output.
func ScalarLiterals ¶ added in v0.3.0
func ScalarLiterals() Option
ScalarLiterals forces the use of literals for scalars, rather than a string representation if available.
For example, `time.Hour` will be printed as `time.Duration(3600000000000)` rather than `time.Duration(1h0m0s)`.