this repo has no description
1package prototype
2
3import "fmt"
4
5type Folder struct {
6 children []Inode
7 name string
8}
9
10func (f *Folder) print(indentation string) {
11 fmt.Println(indentation + f.name)
12 for _, i := range f.children {
13 i.print(indentation + indentation)
14 }
15}
16
17func (f *Folder) clone() Inode {
18 cloneFolder := &Folder{name: f.name + "_clone"}
19 var tempChildren []Inode
20 for _, i := range f.children {
21 copy := i.clone()
22 tempChildren = append(tempChildren, copy)
23 }
24
25 cloneFolder.children = tempChildren
26 return cloneFolder
27}