fix ByParent
This commit is contained in:
parent
6ac33eb649
commit
23c5c13014
8
graph.go
8
graph.go
|
@ -253,14 +253,14 @@ func (graph *Graph) WalkAll(handler func(*Image)) error {
|
||||||
func (graph *Graph) ByParent() (map[string][]*Image, error) {
|
func (graph *Graph) ByParent() (map[string][]*Image, error) {
|
||||||
byParent := make(map[string][]*Image)
|
byParent := make(map[string][]*Image)
|
||||||
err := graph.WalkAll(func(image *Image) {
|
err := graph.WalkAll(func(image *Image) {
|
||||||
image, err := graph.Get(image.Parent)
|
parent, err := graph.Get(image.Parent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if children, exists := byParent[image.Parent]; exists {
|
if children, exists := byParent[parent.Id]; exists {
|
||||||
byParent[image.Parent] = []*Image{image}
|
byParent[parent.Id] = []*Image{image}
|
||||||
} else {
|
} else {
|
||||||
byParent[image.Parent] = append(children, image)
|
byParent[parent.Id] = append(children, image)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return byParent, err
|
return byParent, err
|
||||||
|
|
Loading…
Reference in New Issue