Browse Source

Update README and doc.go with new SortKeys option.

Dave Collins 12 years ago
parent
commit
550ce83cb9
3 changed files with 19 additions and 3 deletions
  1. 8 0
      README.md
  2. 3 3
      spew/config.go
  3. 8 0
      spew/doc.go

+ 8 - 0
README.md

@@ -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

+ 3 - 3
spew/config.go

@@ -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
 }

+ 8 - 0
spew/doc.go

@@ -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: