Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trie := &trieSlice{
- Children: make([]*tNode, 5),
- }
- trie.Children[0] = &tNode{Children: make([]*tNode, 5), IsLeaf: true, Value: 10}
- trie.Children[4] = &tNode{Children: make([]*tNode, 5), IsLeaf: true, Value: 20}
- // YAML marshal
- yamlB, err := yaml.Marshal(trie)
- if err != nil {
- fmt.Println("error in yaml conversion ...", err.Error())
- }
- ioutil.WriteFile("../resources/trieSliceBorder.yml", yamlB, 0644)
- // JSON marshal
- b, err := json.Marshal(trie)
- if err != nil {
- fmt.Println("error while marshalling final trie json ", err.Error())
- t.Fail()
- }
- ioutil.WriteFile("../resources/trieSliceBorder.json", b, 0644)
- {
- "c": [null, null, null, null, {
- "c": [null, null, null, null, null, null, null,
- {
- "c": [null, null, null, null, null, null, null],
- "v": 1,
- "e": true
- }
- ]
- }]
- }```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement