Hacker News new | ask | show | jobs
by sk0g 1148 days ago
My biggest qualm with Go is exactly this. Especially when deserialising data, data that wasn't sent vs empty/default data can be quite different things, yet you have to be very wary of the values you are processing. Ints default to 0, bools to false... Fuck.
1 comments

Then don't use json.Decoder, or use pointers in your structs.
Or better solution, don't use Go.
Sure, do everything in JS. So much easier.
Ah yes, Go and JavaScript, the only two programming languages.
No, but there are no other languages applicable in this context, really. You need a (de)serializer in each and every one of them, so you have to find some library, and that also includes Go. The easy choice in Go is the default one (simply called json), but there are quite a few alternative (de)serializers and validators. The GP just didn't look for them.