Create a map of string to List
Solution 1:
Whenever I've wanted to use a List
I've found that a slice was the right choice, eg
package main
import "fmt"
func main() {
x := make(map[string][]string)
x["key"] = append(x["key"], "value")
x["key"] = append(x["key"], "value1")
fmt.Println(x["key"][0])
fmt.Println(x["key"][1])
}
Solution 2:
My favorite syntax for declaring a map of string to slice of string:
mapOfSlices := map[string][]string{
"first": {},
"second": []string{"one", "two", "three", "four", "five"},
"third": []string{"quarter", "half"},
}