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
Written by Ingo Oeser
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Go
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#