Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Create Map in Go

Map can be created in Go with make syntax. in make syntax, map type is specified with two types, first is key type and second is value type.

Syntax
m := make(map[string]int)


Example : Create a map and values
package main

import "fmt"

func main() {
    myMap := make(map[string]int)
    myMap["k1"] = 7
    myMap["k2"] = 10

    fmt.Printf("%v", myMap)
}


Output
map[k1:7 k2:10]