You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. Attempt to compile
func main() {
m := make(map[interface{}]interface{})
m["key"] = 17
}
What is the expected output?
Successful compilation.
What do you see instead?
invalid map index "key" - need type interface { }
What is your $GOOS? $GOARCH?
amd64, linux
Which revision are you using? (hg identify)
92e9a28d5886+ tip
Please provide any additional information below.
Introducing
var s interface{} = "key"
and writing
m[s] = 17
works. Defining
type Any interface{}
and using
m[Any("key")] = 17
produces
internal compiler error: typename ideal string
(Note: tried m[interface{}("key")] = 17; fails with a syntax
error, "unexpected interface", don't know whether this is a
bug or not, haven't looked yet.)