Index: common/dirwalk/tests/tools/walkdir/walkers_print.go |
diff --git a/common/dirwalk/tests/tools/walkdir/walkers_print.go b/common/dirwalk/tests/tools/walkdir/walkers_print.go |
new file mode 100644 |
index 0000000000000000000000000000000000000000..dd93eedd11f59945e54094c9129e69f18967a6d3 |
--- /dev/null |
+++ b/common/dirwalk/tests/tools/walkdir/walkers_print.go |
@@ -0,0 +1,30 @@ |
+// Copyright 2016 The LUCI Authors. All rights reserved. |
+// Use of this source code is governed under the Apache License, Version 2.0 |
+// that can be found in the LICENSE file. |
+ |
+package main |
+ |
+import ( |
+ "fmt" |
+ "io" |
+) |
+ |
+// PrintWalker implements Walker. It prints the filename of each found file. |
+type PrintWalker struct { |
+ BaseWalker |
+ obuf io.Writer |
+} |
+ |
+func (p *PrintWalker) PrintFile(filename string) { |
+ fmt.Fprintln(p.obuf, filename) |
+} |
+ |
+func (p *PrintWalker) SmallFile(filename string, alldata []byte) { |
+ p.BaseWalker.SmallFile(filename, alldata) |
+ p.PrintFile(filename) |
+} |
+ |
+func (p *PrintWalker) LargeFile(filename string) { |
+ p.BaseWalker.LargeFile(filename) |
+ p.PrintFile(filename) |
+} |