> If you don't use the dual return it panics if the actual type is different
> from the one you try to assert.

from the language specification:

" x.(T)

asserts that x is not nil and that the value stored in x is of type T.
The notation x.(T) is called a type assertion.
[...]
If the type assertion holds, the value of the expression is the value
stored in x and its type is T. If the type assertion is false, a
run-time panic occurs."

https://golang.org/ref/spec#Type_assertions

the key to why _ = m["abc"] works lies in this text:

"For a of map type M:

x's type must be assignable to the key type of M
[...]
if the map is nil or does not contain such an entry, a[x] is the zero
value for the value type of M"

https://golang.org/ref/spec#Index_expressions

-- 
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.

Reply via email to