> I just want to understand what is the deep reason for the syntax > inconsistency between map index and type assert.
a map is fully typed at compile time. even if its key is of type interface{} the language defines how to compare two interface{} values using type assertion here: https://golang.org/ref/spec#Comparison_operators "Interface values are comparable. Two interface values are equal if they have identical dynamic types and equal dynamic values or if both have value nil." Using interface{} in assignments on the other hand is only type-safe at runtime when used with a type assertion. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.