浏览代码

Merge pull request #18024 from LK4D4/simple_byparent

graph/graph.go: simplify appending to slice in map in byParent
Michael Crosby 9 年之前
父节点
当前提交
e58b0bba7f
共有 1 个文件被更改,包括 1 次插入5 次删除
  1. 1 5
      graph/graph.go

+ 1 - 5
graph/graph.go

@@ -477,11 +477,7 @@ func (graph *Graph) ByParent() map[string][]*image.Image {
 		if err != nil {
 			return
 		}
-		if children, exists := byParent[parent.ID]; exists {
-			byParent[parent.ID] = append(children, img)
-		} else {
-			byParent[parent.ID] = []*image.Image{img}
-		}
+		byParent[parent.ID] = append(byParent[parent.ID], img)
 	})
 	return byParent
 }