Skip to content

Commit

Permalink
Merge pull request #2944 from weaveworks/fewer-ref
Browse files Browse the repository at this point in the history
pass render filters and maps by value rather than reference
  • Loading branch information
rade authored Nov 18, 2017
2 parents a375891 + aaf4e54 commit 830cfc9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions render/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ type Filter struct {

// MakeFilter makes a new Filter (that ignores pseudo nodes).
func MakeFilter(f FilterFunc, r Renderer) Renderer {
return &Filter{
return Filter{
Renderer: r,
FilterFunc: func(n report.Node) bool {
return n.Topology == Pseudo || f(n)
Expand All @@ -118,7 +118,7 @@ func MakeFilter(f FilterFunc, r Renderer) Renderer {

// MakeFilterPseudo makes a new Filter that will not ignore pseudo nodes.
func MakeFilterPseudo(f FilterFunc, r Renderer) Renderer {
return &Filter{
return Filter{
Renderer: r,
FilterFunc: f,
}
Expand All @@ -141,11 +141,11 @@ func MakeFilterPseudoDecorator(f FilterFunc) Decorator {
}

// Render implements Renderer
func (f *Filter) Render(rpt report.Report, dct Decorator) Nodes {
func (f Filter) Render(rpt report.Report, dct Decorator) Nodes {
return f.render(rpt, dct)
}

func (f *Filter) render(rpt report.Report, dct Decorator) Nodes {
func (f Filter) render(rpt report.Report, dct Decorator) Nodes {
output := report.Nodes{}
inDegrees := map[string]int{}
filtered := 0
Expand Down
4 changes: 2 additions & 2 deletions render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ type Map struct {

// MakeMap makes a new Map
func MakeMap(f MapFunc, r Renderer) Renderer {
return &Map{f, r}
return Map{f, r}
}

// Render transforms a set of Nodes produces by another Renderer.
// using a map function
func (m *Map) Render(rpt report.Report, dct Decorator) Nodes {
func (m Map) Render(rpt report.Report, dct Decorator) Nodes {
var (
input = m.Renderer.Render(rpt, dct)
output = report.Nodes{}
Expand Down

0 comments on commit 830cfc9

Please sign in to comment.