volumes: simplify append-to-slice code

This commit is contained in:
Justin Santa Barbara 2017-02-28 10:37:28 -05:00
parent 49d1814b3a
commit 1d357b334f

View File

@ -557,10 +557,7 @@ func (asw *actualStateOfWorld) GetAttachedVolumesPerNode() map[types.NodeName][]
attachedVolumesPerNode := make(map[types.NodeName][]operationexecutor.AttachedVolume)
for _, volumeObj := range asw.attachedVolumes {
for nodeName, nodeObj := range volumeObj.nodesAttachedTo {
volumes, exists := attachedVolumesPerNode[nodeName]
if !exists {
volumes = []operationexecutor.AttachedVolume{}
}
volumes := attachedVolumesPerNode[nodeName]
volumes = append(volumes, getAttachedVolume(&volumeObj, &nodeObj).AttachedVolume)
attachedVolumesPerNode[nodeName] = volumes
}