3 ms·
Golang maps returns the value type's zero value in case the key doesn't exist: https://blog.golang.org/go-maps-in-action https://blog.golang.org/go-maps-in-acti
by loopz 7y ago
Golang maps returns the value type's zero value in case the key doesn't exist: https://blog.golang.org/go-maps-in-action https://blog.golang.org/go-maps-in-action
The idiomatic way here being that the zero value should be a sane default for that value. You are then free to create your own types ontop of that, but the defaults are often in the ballpark of where you want to be unless you have specific needs in your context.