Created
June 2, 2022 22:33
-
-
Save fixwa/ece0691c3335a57fd49e3e07df2aa94c to your computer and use it in GitHub Desktop.
Filling Map Of Map in Go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strconv" | |
) | |
var data map[string]map[string]map[string]string | |
var yuno map[string]map[string]string | |
func main() { | |
data = map[string]map[string]map[string]string{} | |
data["ROOT"] = map[string]map[string]string{} | |
data["ROOT"] = make(map[string]map[string]string, 1) | |
//data["ROOT"] = make(map[string]map[string]string, 0) | |
data["ROOT"]["Child_A"] = map[string]string{} | |
data["ROOT"]["Child_A"] = make(map[string]string, 0) | |
//data["ROOT"]["Child_A"] = make(map[string]string, 0) | |
data["ROOT"]["Child_A"]["ChildOfChild_A"] = "white" | |
data["ROOT"]["Child_A"]["command_2"] = "blue" | |
data["ROOT"]["Child_A"]["command_3"] = "red" | |
//fmt.Println("data: ", data) | |
yuno = map[string]map[string]string{} | |
for i := 0; i < 10; i++ { | |
yuno["testing"] = map[string]string{} | |
// yuno["Hola"] = make(map[string]string, 10) | |
for j := 0; j < 1200; j++ { | |
yuno["testing"]["Placeholder"+strconv.Itoa(j)] = "Amiright?" | |
} | |
} | |
fmt.Println("Yuno: ", yuno) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment