Replies: 1 comment
-
Try using a better debug output library like go-spew. It will correctly handle introspecting the nils and will give you much better output anyway. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
In some scenarios, I want to print models that boiler generated to stdout using fmt package for debug, But sometimes it throws panic because there are nil fields for some boil-defined type, such as
types.NullDecimal
, The root cause is those types do not implement Stringer interface.Solution
I think it's good practice to implement Stringer interface for boil-defined types. e.g. For
types.NullDecimal
Does it make sense?
Beta Was this translation helpful? Give feedback.
All reactions