diff --git a/v23/mkline.go b/v23/mkline.go index b9ad413b..db8bbffe 100644 --- a/v23/mkline.go +++ b/v23/mkline.go @@ -845,12 +845,12 @@ func (mkline *MkLine) VariableNeedsQuoting(mklines *MkLines, expr *MkExpr, varty // ForEachUsed calls the action for each variable that is used in the line. func (mkline *MkLine) ForEachUsed(action func(expr *MkExpr, time EctxTime)) { - walker := NewMkWalker(mkline, action) + walker := NewMkWalker(action) walker.WalkLine(mkline) } func (mkline *MkLine) ForEachUsedText(text string, time EctxTime, action func(expr *MkExpr, time EctxTime)) { - walker := NewMkWalker(mkline, action) + walker := NewMkWalker(action) walker.WalkText(text, time) } diff --git a/v23/mkwalker.go b/v23/mkwalker.go index c12ea53d..633152d2 100644 --- a/v23/mkwalker.go +++ b/v23/mkwalker.go @@ -3,12 +3,11 @@ package pkglint // MkWalker walks through a makefile line or a text snippet from such a line, // visiting the expressions and their subexpressions. type MkWalker struct { - Diag Autofixer Expr func(expr *MkExpr, time EctxTime) } -func NewMkWalker(diag Autofixer, expr func(expr *MkExpr, time EctxTime)) *MkWalker { - return &MkWalker{diag, expr} +func NewMkWalker(expr func(expr *MkExpr, time EctxTime)) *MkWalker { + return &MkWalker{expr} } // WalkLine calls the action for each variable that is used in the line. diff --git a/v23/mkwalker_test.go b/v23/mkwalker_test.go index 3fbd976c..c2bae462 100644 --- a/v23/mkwalker_test.go +++ b/v23/mkwalker_test.go @@ -10,7 +10,7 @@ func (s *Suite) Test_NewMkWalker(c *check.C) { mkline.Notef("Expression \"%s\" at \"%s\" time.", expr.String(), time.String()) } - walker := NewMkWalker(mkline, action) + walker := NewMkWalker(action) walker.WalkLine(mkline) t.CheckOutputLines( @@ -35,7 +35,7 @@ func (s *Suite) Test_MkWalker_WalkLine(c *check.C) { action := func(expr *MkExpr, time EctxTime) { mkline.Notef("Expression \"%s\" at \"%s\" time.", expr.String(), time.String()) } - walker := NewMkWalker(mkline, action) + walker := NewMkWalker(action) walker.WalkLine(mkline) }) @@ -63,7 +63,7 @@ func (s *Suite) Test_MkWalker_WalkText(c *check.C) { action := func(expr *MkExpr, time EctxTime) { mkline.Notef("Expression \"%s\" at \"%s\" time.", expr.String(), time.String()) } - walker := NewMkWalker(mkline, action) + walker := NewMkWalker(action) walker.WalkLine(mkline) }) @@ -83,7 +83,7 @@ func (s *Suite) Test_MkWalker_walkDirective(c *check.C) { action := func(expr *MkExpr, time EctxTime) { mkline.Notef("Expression \"%s\" at \"%s\" time.", expr.String(), time.String()) } - walker := NewMkWalker(mkline, action) + walker := NewMkWalker(action) walker.walkDirective(mkline) }) @@ -102,7 +102,7 @@ func (s *Suite) Test_MkWalker_walkExpr(c *check.C) { action := func(expr *MkExpr, time EctxTime) { mkline.Notef("Expression \"%s\" at \"%s\" time.", expr.String(), time.String()) } - walker := NewMkWalker(mkline, action) + walker := NewMkWalker(action) walker.WalkLine(mkline) }) @@ -125,7 +125,7 @@ func (s *Suite) Test_MkWalker_walkModifier(c *check.C) { action := func(expr *MkExpr, time EctxTime) { mkline.Notef("Expression \"%s\" at \"%s\" time.", expr.String(), time.String()) } - walker := NewMkWalker(mkline, action) + walker := NewMkWalker(action) walker.WalkLine(mkline) })