3 ms·
> when you need to identify the difference between unset and zero. Use pointer variables ? Works 4 me.
by euroderf 3y ago
> when you need to identify the difference between unset and zero.
Use pointer variables ? Works 4 me.
- campbel 3y agoAlso what I do. You could theoretically also create your own type that manages deserialization and includes an "is_set" field.
- euroderf 3y agoFWIW: calling Error() on a nil error is an obnoxious NPE fail, so I made this: https://pkg.go.dev/github.com/fbaube/miscutils#Errer https://pkg.go.dev/github.com/fbaube/miscutils#Errer