This commit is contained in:
Matthias Radestock
2016-08-14 14:54:09 +01:00
parent 6334836f69
commit 003e13face
3 changed files with 5 additions and 13 deletions

View File

@@ -81,8 +81,7 @@ func (m *Map) Render(rpt report.Report, dct Decorator) report.Nodes {
// Rewrite all the nodes according to the map function
for _, inRenderable := range input {
for _, outRenderable := range m.MapFunc(inRenderable, localNetworks) {
existing, ok := output[outRenderable.ID]
if ok {
if existing, ok := output[outRenderable.ID]; ok {
outRenderable = outRenderable.Merge(existing)
}

View File

@@ -39,16 +39,13 @@ func (c EdgeMetadatas) Add(key string, value EdgeMetadata) EdgeMetadatas {
if existingValue, ok := c.psMap.Lookup(key); ok {
value = value.Merge(existingValue.(EdgeMetadata))
}
return EdgeMetadatas{
c.psMap.Set(key, value),
}
return EdgeMetadatas{c.psMap.Set(key, value)}
}
// Lookup the counter 'key'
func (c EdgeMetadatas) Lookup(key string) (EdgeMetadata, bool) {
if c.psMap != nil {
existingValue, ok := c.psMap.Lookup(key)
if ok {
if existingValue, ok := c.psMap.Lookup(key); ok {
return existingValue.(EdgeMetadata), true
}
}

View File

@@ -41,9 +41,7 @@ func (s Sets) Add(key string, value StringSet) Sets {
if existingValue, ok := s.psMap.Lookup(key); ok {
value = value.Merge(existingValue.(StringSet))
}
return Sets{
psMap: s.psMap.Set(key, value),
}
return Sets{psMap: s.psMap.Set(key, value)}
}
// Delete the given set from the Sets.
@@ -51,9 +49,7 @@ func (s Sets) Delete(key string) Sets {
if s.psMap == nil {
return EmptySets
}
return Sets{
psMap: s.psMap.Delete(key),
}
return Sets{psMap: s.psMap.Delete(key)}
}
// Lookup returns the sets stored under key.