Catch panics when calling GoString like fmt %#v does (#87)
This handles a few cases (similar to how fmt %#v does):
- A GoString method on a value receiver, called with a nil pointer
- A GoString method on a pointer receiver that doesn't check for nil
- A GoString method that panics in some other way
Because Go 1.17 added a method Time.GoString with value receiver, this
broke structs that had *time.Time fields with nil values (which is
common!).
Also added a bunch of tests for these cases.
Fixes #77
Co-authored-by: Jordan Barrett <jordan.barrett@canonical.com>
3 files changed