浏览代码

Update docs for new byte array and slice behavior.

Dave Collins 12 年之前
父节点
当前提交
096da7a702
共有 4 个文件被更改,包括 16 次插入1 次删除
  1. 1 1
      README.md
  2. 2 0
      spew/config.go
  3. 11 0
      spew/doc.go
  4. 2 0
      spew/dump.go

+ 1 - 1
README.md

@@ -62,7 +62,7 @@ spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
   (string) "one": (bool) true
   (string) "one": (bool) true
  }
  }
 }
 }
-([]byte) {
+([]uint8) {
  00000000  11 12 13 14 15 16 17 18  19 1a 1b 1c 1d 1e 1f 20  |............... |
  00000000  11 12 13 14 15 16 17 18  19 1a 1b 1c 1d 1e 1f 20  |............... |
  00000010  21 22 23 24 25 26 27 28  29 2a 2b 2c 2d 2e 2f 30  |!"#$%&'()*+,-./0|
  00000010  21 22 23 24 25 26 27 28  29 2a 2b 2c 2d 2e 2f 30  |!"#$%&'()*+,-./0|
  00000020  31 32                                             |12|
  00000020  31 32                                             |12|

+ 2 - 0
spew/config.go

@@ -235,6 +235,8 @@ package:
 	* Custom types which only implement the Stringer/error interfaces via
 	* Custom types which only implement the Stringer/error interfaces via
 	  a pointer receiver are optionally invoked when passing non-pointer
 	  a pointer receiver are optionally invoked when passing non-pointer
 	  variables
 	  variables
+	* Byte arrays and slices are dumped like the hexdump -C command which
+	  includes offsets, byte values in hex, and ASCII output
 
 
 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.

+ 11 - 0
spew/doc.go

@@ -28,6 +28,9 @@ printing facilities for Go data types are as follows:
 	* Custom types which only implement the Stringer/error interfaces via
 	* Custom types which only implement the Stringer/error interfaces via
 	  a pointer receiver are optionally invoked when passing non-pointer
 	  a pointer receiver are optionally invoked when passing non-pointer
 	  variables
 	  variables
+	* Byte arrays and slices are dumped like the hexdump -C command which
+	  includes offsets, byte values in hex, and ASCII output (only when using
+	  Dump style)
 
 
 There are two different approaches spew allows for dumping Go data structures:
 There are two different approaches spew allows for dumping Go data structures:
 
 
@@ -117,6 +120,14 @@ shown here.
 	 }
 	 }
 	}
 	}
 
 
+Byte (and uint8) arrays and slices are displayed uniquely like the hexdump -C
+command as shown.
+	([]uint8) {
+	 00000000  11 12 13 14 15 16 17 18  19 1a 1b 1c 1d 1e 1f 20  |............... |
+	 00000010  21 22 23 24 25 26 27 28  29 2a 2b 2c 2d 2e 2f 30  |!"#$%&'()*+,-./0|
+	 00000020  31 32                                             |12|
+	}
+
 Custom Formatter
 Custom Formatter
 
 
 Spew provides a custom formatter the implements the fmt.Formatter interface
 Spew provides a custom formatter the implements the fmt.Formatter interface

+ 2 - 0
spew/dump.go

@@ -377,6 +377,8 @@ package:
 	* Custom types which only implement the Stringer/error interfaces via
 	* Custom types which only implement the Stringer/error interfaces via
 	  a pointer receiver are optionally invoked when passing non-pointer
 	  a pointer receiver are optionally invoked when passing non-pointer
 	  variables
 	  variables
+	* Byte arrays and slices are dumped like the hexdump -C command which
+	  includes offsets, byte values in hex, and ASCII output
 
 
 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.