Index: common/dirwalk/tests/tools/walkdir/fileprocessor_print.go |
diff --git a/common/dirwalk/tests/tools/walkdir/fileprocessor_print.go b/common/dirwalk/tests/tools/walkdir/fileprocessor_print.go |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f86dc8735e9c271a0d8b8c06f36c762ca75e0fd2 |
--- /dev/null |
+++ b/common/dirwalk/tests/tools/walkdir/fileprocessor_print.go |
@@ -0,0 +1,31 @@ |
+// 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" |
+) |
+ |
+// PrintFileProcessor implements FileProcessor. It prints the path of each found file. |
+type PrintFileProcessor struct { |
+ BaseFileProcessor |
+ obuf io.Writer |
+} |
+ |
+func (p *PrintFileProcessor) Dir(path string) { |
+ fmt.Fprintln(p.obuf, " dir", path) |
+ p.BaseFileProcessor.Dir(path) |
+} |
+ |
+func (p *PrintFileProcessor) SmallFile(path string, r io.ReadCloser) { |
+ fmt.Fprintln(p.obuf, "small", path) |
+ p.BaseFileProcessor.SmallFile(path, r) |
+} |
+ |
+func (p *PrintFileProcessor) LargeFile(path string, r io.ReadCloser) { |
+ fmt.Fprintln(p.obuf, "large", path) |
+ p.BaseFileProcessor.LargeFile(path, r) |
+} |