davecgh / go-spew

Implements a deep pretty printer for Go data structures to aid in debugging
ISC License
6.05k stars 364 forks source link

feat (DisableFunctionTypePointerAddresses) hiding pointers for func fields #105

Open pentateu opened 5 years ago

pentateu commented 5 years ago

Added DisableFunctionTypePointerAddresses to config.

If true it will not print the address of a Func field.

Example: type someFuncType func(string) string type someStructType struct { funcField someFuncType }

before this PR this would print: (*spew_test.ptrFuncTester)({ funcField: (spew_test.someFuncType) 0x11a49b0 })

With this PR and DisableFunctionTypePointerAddresses = true it will print: (*spew_test.ptrFuncTester)({ funcField: (spew_test.someFuncType) })

This is important for snapshot testing, which is my use case.

Cheers