3 ms·
Golang has generics now and I'm already using them. They're great! But that's an obvious point. I use Golang professionally every day, and these aren't the sor
by tastysandwich 4y ago
Golang has generics now and I'm already using them. They're great! But that's an obvious point.
I use Golang professionally every day, and these aren't the sorts of things that I run into. Then again, we run everything on Linux.
One thing I wish Golang had was the ability to easily deep clone things. Especially if you have a struct with nested struct _pointers_.
Options now are manually doing it field-by-field (error prone, if a new field is added you might miss it); using reflection (yuck!); or marshalling to JSON and back again.
Another thing is when reading to/from JSON, being able to differentiate between a field which doesn't exist ("undefined" in Javascript), or is null. Unfortunately some third-party APIs I interact with treat "null" as a command to remove the field. But if you use `omitempty`, you can't have null at all.
Other than that though, it's a treat to work with!