Bläddra i källkod

Update README and doc.go with new SortKeys option.

Dave Collins 12 år sedan
förälder
incheckning
550ce83cb9
3 ändrade filer med 19 tillägg och 3 borttagningar
  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
 * ContinueOnMethod
 	Enables recursion into types after invoking error and Stringer interface
 	Enables recursion into types after invoking error and Stringer interface
 	methods. Recursion after method invocation is disabled by default.
 	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
 ## License

+ 3 - 3
spew/config.go

@@ -75,9 +75,9 @@ type ConfigState struct {
 	ContinueOnMethod bool
 	ContinueOnMethod bool
 
 
 	// SortKeys specifies map keys should be sorted before being printed. Use
 	// 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.
 	// which guarantees display stability.
 	SortKeys bool
 	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
 		Enables recursion into types after invoking error and Stringer interface
 		methods. Recursion after method invocation is disabled by default.
 		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
 Dump Usage
 
 
 Simply call spew.Dump with a list of variables you want to dump:
 Simply call spew.Dump with a list of variables you want to dump: