Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch panics when calling GoString like fmt %#v does (#1) #87

Merged
merged 1 commit into from Aug 25, 2022

Commits on Aug 21, 2022

  1. Catch panics when calling GoString like fmt %#v does (#1)

    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.
    
    This should address kr#77
    
    Co-authored-by: Jordan Barrett <jordan.barrett@canonical.com>
    benhoyt and barrettj12 committed Aug 21, 2022
    Configuration menu
    Copy the full SHA
    771f4dc View commit details
    Browse the repository at this point in the history