Go - Map

Card Puncher Data Processing


Map in Go.

A map is a reference structure created by make.


A map with a string as key and an int as value.

counts := make(map[string]int)


Get the key

keys := []string(reflect.ValueOf(myMap).MapKeys())
# or
keys := make([]int, len(mymap))
i := 0
for k := range mymap {
    keys[i] = k

Get the value (Map Lookup)

v, ok = m[key] 


  • ok is a Boolean

Discover More
Card Puncher Data Processing
Go - Function

where: (file File) defines with which type the method function is coupled Write is the name of the function b []byte is the parameter of the function (n int, err error) is the return variables...
Card Puncher Data Processing
Go - Reference Type

Reference type in go , , , ,

Share this page:
Follow us:
Task Runner