Browse Source

Update docs for new Sdump function.

Dave Collins 12 years ago
parent
commit
691853c424
3 changed files with 10 additions and 3 deletions
  1. 2 1
      spew/config.go
  2. 6 1
      spew/doc.go
  3. 2 1
      spew/dump.go

+ 2 - 1
spew/config.go

@@ -242,7 +242,8 @@ package:
 The configuration options are controlled by modifying the public members
 The configuration options are controlled by modifying the public members
 of c.  See ConfigState for options documentation.
 of c.  See ConfigState for options documentation.
 
 
-See Fdump if you would prefer dumping to an arbitrary io.Writer.
+See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to
+get the formatted result as a string.
 */
 */
 func (c *ConfigState) Dump(a ...interface{}) {
 func (c *ConfigState) Dump(a ...interface{}) {
 	fdump(c, os.Stdout, a...)
 	fdump(c, os.Stdout, a...)

+ 6 - 1
spew/doc.go

@@ -49,9 +49,10 @@ This section demonstrates how to quickly get started with spew.  See the
 sections below for further details on formatting and configuration options.
 sections below for further details on formatting and configuration options.
 
 
 To dump a variable with full newlines, indentation, type, and pointer
 To dump a variable with full newlines, indentation, type, and pointer
-information use Dump or Fdump:
+information use Dump, Fdump, or Sdump:
 	spew.Dump(myVar1, myVar2, ...)
 	spew.Dump(myVar1, myVar2, ...)
 	spew.Fdump(someWriter, myVar1, myVar2, ...)
 	spew.Fdump(someWriter, myVar1, myVar2, ...)
+	str := spew.Sdump(myVar1, myVar2, ...)
 
 
 Alternatively, if you would prefer to use format strings with a compacted inline
 Alternatively, if you would prefer to use format strings with a compacted inline
 printing style, use the convenience wrappers Printf, Fprintf, etc with
 printing style, use the convenience wrappers Printf, Fprintf, etc with
@@ -105,6 +106,10 @@ io.Writer.  For example, to dump to standard error:
 
 
 	spew.Fdump(os.Stderr, myVar1, myVar2, ...)
 	spew.Fdump(os.Stderr, myVar1, myVar2, ...)
 
 
+A third option is to call spew.Sdump to get the formatted output as a string:
+
+	str := spew.Sdump(myVar1, myVar2, ...)
+
 Sample Dump Output
 Sample Dump Output
 
 
 See the Dump example for details on the setup of the types and variables being
 See the Dump example for details on the setup of the types and variables being

+ 2 - 1
spew/dump.go

@@ -391,7 +391,8 @@ package:
 The configuration options are controlled by an exported package global,
 The configuration options are controlled by an exported package global,
 spew.Config.  See ConfigState for options documentation.
 spew.Config.  See ConfigState for options documentation.
 
 
-See Fdump if you would prefer dumping to an arbitrary io.Writer.
+See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to
+get the formatted result as a string.
 */
 */
 func Dump(a ...interface{}) {
 func Dump(a ...interface{}) {
 	fdump(&Config, os.Stdout, a...)
 	fdump(&Config, os.Stdout, a...)