Hacker News new | ask | show | jobs
by HeyImAlex 3400 days ago
Actually I just tried that and it worked also. But I think you're right that this hasn't always been the case because I remember being annoyed about it. Or maybe we're both crazy.

You definitely need to specify the type for an interface, but that makes sense.

1 comments

You're not crazy. I also have vague memories of maps being more obnoxious in Go. :)

The facts are that map literals did change a bit in Go 1.5 (i.e. fairly recently), full literal specification for values could already be elided back then - it was KEYS that required full specification: https://golang.org/doc/go1.5#map_literals

If you go way more back, Go 1 also saved some typing on values, in case they were pointers: https://golang.org/doc/go1#literals