Skip to content

Commit

Permalink
Update README and doc.go with new SortKeys option.
Browse files Browse the repository at this point in the history
  • Loading branch information
davecgh committed Nov 16, 2013
1 parent 92b7ef3 commit 550ce83
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ options. See the ConfigState documentation for more details.
* ContinueOnMethod
Enables recursion into types after invoking error and Stringer interface
methods. Recursion after method invocation is disabled by default.
* SortKeys
Specifies map keys should be sorted before being printed. Use
this to have a more deterministic, diffable output. Note that
only native types (bool, int, uint, floats, uintptr and string)
are supported with other types sorted according to the
reflect.Value.String() output which guarantees display stability.
Natural map order is used by default.
```

## License
Expand Down
6 changes: 3 additions & 3 deletions spew/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ type ConfigState struct {
ContinueOnMethod bool

// SortKeys specifies map keys should be sorted before being printed. Use
// this to have a more deterministic, diffable output. Note that only
// native types (bool, int, uint, floats, uintptr and string) are supported,
// other types will be sort according to the reflect.Value.String() output
// this to have a more deterministic, diffable output. Note that only
// native types (bool, int, uint, floats, uintptr and string) are supported
// with other types sorted according to the reflect.Value.String() output
// which guarantees display stability.
SortKeys bool
}
Expand Down
8 changes: 8 additions & 0 deletions spew/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ The following configuration options are available:
Enables recursion into types after invoking error and Stringer interface
methods. Recursion after method invocation is disabled by default.
* SortKeys
Specifies map keys should be sorted before being printed. Use
this to have a more deterministic, diffable output. Note that
only native types (bool, int, uint, floats, uintptr and string)
are supported with other types sorted according to the
reflect.Value.String() output which guarantees display stability.
Natural map order is used by default.
Dump Usage
Simply call spew.Dump with a list of variables you want to dump:
Expand Down

0 comments on commit 550ce83

Please sign in to comment.