Index: common/dirwalk/tests/tools/walkdir/util.go |
diff --git a/common/dirwalk/tests/tools/walkdir/util.go b/common/dirwalk/tests/tools/walkdir/util.go |
new file mode 100644 |
index 0000000000000000000000000000000000000000..03b38f9cfa593c918130562f0a97838edc877308 |
--- /dev/null |
+++ b/common/dirwalk/tests/tools/walkdir/util.go |
@@ -0,0 +1,20 @@ |
+// 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 ( |
+ "io" |
+ |
+ "github.com/luci/luci-go/common/isolated" |
+) |
+ |
+func hash(src io.Reader) (isolated.HexDigest, uint64, error) { |
+ h := isolated.GetHash() |
+ bytes, err := io.Copy(h, src) |
+ if err != nil { |
+ return isolated.HexDigest(""), 0, err |
+ } |
+ return isolated.Sum(h), uint64(bytes), nil |
+} |