@@ -47,7 +47,7 @@ func formatDot(in interface{}) (out string) {
4747 return fmt .Sprintf ("graph{\n %s}" , buf .String ())
4848}
4949
50- func flatten (in interface {}, current_path string ) ([]node , []link ) {
50+ func flatten (in interface {}, currentPath string ) ([]node , []link ) {
5151 var nodes []node
5252 var links []link
5353
@@ -62,62 +62,62 @@ func flatten(in interface{}, current_path string) ([]node, []link) {
6262 vv := in .(map [string ]interface {})
6363
6464 for key , value := range vv {
65- target := current_path + "-" + key
65+ target := currentPath + "-" + key
6666
6767 nodes = append (nodes , node {
6868 name : target ,
6969 label : key ,
7070 })
7171
72- if current_path != "" {
72+ if currentPath != "" {
7373 links = append (links , link {
74- left : current_path ,
74+ left : currentPath ,
7575 right : target ,
7676 })
7777 }
7878
79- new_nodes , new_links := flatten (value , target )
79+ newNodes , newLinks := flatten (value , target )
8080
81- nodes = append (nodes , new_nodes ... )
82- links = append (links , new_links ... )
81+ nodes = append (nodes , newNodes ... )
82+ links = append (links , newLinks ... )
8383 }
8484
8585 return nodes , links
8686 case reflect .Array , reflect .Slice :
8787 for index := 0 ; index < val .Len (); index ++ {
8888 value := val .Index (index ).Interface ()
8989
90- target := current_path + "-" + fmt .Sprint (index )
90+ target := currentPath + "-" + fmt .Sprint (index )
9191
9292 nodes = append (nodes , node {
9393 name : target ,
9494 label : fmt .Sprintf ("[%d]" , index ),
9595 })
9696
97- if current_path != "" {
97+ if currentPath != "" {
9898 links = append (links , link {
99- left : current_path ,
99+ left : currentPath ,
100100 right : target ,
101101 })
102102 }
103103
104- new_nodes , new_links := flatten (value , target )
104+ newNodes , newLinks := flatten (value , target )
105105
106- nodes = append (nodes , new_nodes ... )
107- links = append (links , new_links ... )
106+ nodes = append (nodes , newNodes ... )
107+ links = append (links , newLinks ... )
108108 }
109109
110110 return nodes , links
111111 default :
112- target := current_path + "=content"
112+ target := currentPath + "=content"
113113
114114 nodes = append (nodes , node {
115115 name : target ,
116116 label : fmt .Sprint (in ),
117117 })
118118
119119 links = append (links , link {
120- left : current_path ,
120+ left : currentPath ,
121121 right : target ,
122122 })
123123
0 commit comments