Last Updated: February 25, 2016
·
444
· nightlyone

Flexible maps in Go

I just re-discovered how flexible maps really are. So I wanted to show this little gem
```go
package main

import "fmt"

func main() {
    flexmap := make(map[interface{}]string)
    flexmap[1] = "one"
    flexmap[2.1] = "two dot one"
    flexmap["highlander"] = "there can be only one"
    for key, value := range flexmap {
        fmt.Println(key, "=", value)
    }
}
http://play.golang.org/p/AHh8bfBdsp