Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass render filters and maps by value rather than reference #2944

Merged
merged 1 commit into from
Nov 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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