Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> when you need to identify the difference between unset and zero.

Use pointer variables ? Works 4 me.



Also what I do. You could theoretically also create your own type that manages deserialization and includes an "is_set" field.


FWIW: calling Error() on a nil error is an obnoxious NPE fail, so I made this: https://pkg.go.dev/github.com/fbaube/miscutils#Errer




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: