summaryrefslogtreecommitdiff
path: root/spew/example_test.go
diff options
context:
space:
mode:
authorDave Collins <[email protected]>2015-06-17 22:34:22 -0500
committerDave Collins <[email protected]>2015-06-19 15:29:34 -0500
commit2df174808ee097f90d259e432cc04442cf60be21 (patch)
tree137a52652745f1dc47abb8ab3d379cb556e6e632 /spew/example_test.go
parentf9f629a1d082960e5d1747f33c2b378612615fea (diff)
Add support for limited mode without unsafe pkg.
This commit adds support for compiling spew without the unsafe package. When compiled without the unsafe package, some of the more advanced features such as invoking stringers on pointers from non-pointer variables and unexported struct fields are not available. By default, spew will be compiled in the limited mode for Google App Engine since the unsafe package is not available there. Additionally, spew can be compiled without the unsafe package manually by specifying the "disableunsafe" build tag. Finally, a new package-level constant named "UnsafeDisabled" has been exposed which can be used to programmatically determine if spew was compiled with access to the unsafe package.
Diffstat (limited to 'spew/example_test.go')
-rw-r--r--spew/example_test.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/spew/example_test.go b/spew/example_test.go
index a7acd14..de6c4e3 100644
--- a/spew/example_test.go
+++ b/spew/example_test.go
@@ -18,6 +18,7 @@ package spew_test
import (
"fmt"
+
"github.com/davecgh/go-spew/spew"
)
@@ -41,7 +42,6 @@ func (f Flag) String() string {
}
type Bar struct {
- flag Flag
data uintptr
}
@@ -74,7 +74,6 @@ func ExampleDump() {
}
type Bar struct {
- flag Flag
data uintptr
}
@@ -85,7 +84,7 @@ func ExampleDump() {
*/
// Setup some sample data structures for the example.
- bar := Bar{Flag(flagTwo), uintptr(0)}
+ bar := Bar{uintptr(0)}
s1 := Foo{bar, map[interface{}]interface{}{"one": true}}
f := Flag(5)
b := []byte{
@@ -102,7 +101,6 @@ func ExampleDump() {
// Output:
// (spew_test.Foo) {
// unexportedField: (spew_test.Bar) {
- // flag: (spew_test.Flag) flagTwo,
// data: (uintptr) <nil>
// },
// ExportedField: (map[interface {}]interface {}) (len=1) {
@@ -172,7 +170,7 @@ func ExampleConfigState_Dump() {
scs2 := spew.ConfigState{Indent: " "}
// Setup some sample data structures for the example.
- bar := Bar{Flag(flagTwo), uintptr(0)}
+ bar := Bar{uintptr(0)}
s1 := Foo{bar, map[interface{}]interface{}{"one": true}}
// Dump using the ConfigState instances.
@@ -182,7 +180,6 @@ func ExampleConfigState_Dump() {
// Output:
// (spew_test.Foo) {
// unexportedField: (spew_test.Bar) {
- // flag: (spew_test.Flag) flagTwo,
// data: (uintptr) <nil>
// },
// ExportedField: (map[interface {}]interface {}) (len=1) {
@@ -191,7 +188,6 @@ func ExampleConfigState_Dump() {
// }
// (spew_test.Foo) {
// unexportedField: (spew_test.Bar) {
- // flag: (spew_test.Flag) flagTwo,
// data: (uintptr) <nil>
// },
// ExportedField: (map[interface {}]interface {}) (len=1) {