Closed nathanfranke closed 2 years ago
This is expected.
Should the documentation for Stringer
be updated then?
Stringer adds the field key with val.String() (or null if val is nil) to the *Event context.
Also, methods in libraries should not panic. The convention in the Go libraries is that even when a package uses panic internally, its external API still presents explicit error return values.
It does not use panic(), you are sending a nil pointer, this is a programming error.
Stringer adds the field key with val.String() (or null if val is nil) to the *Event context.
If you send nil
it won’t panic but that’s not what you are doing. See https://glucn.medium.com/golang-an-interface-holding-a-nil-value-is-not-nil-bb151f472cc7 for more context.