Reset hash state between runs.

This commit is contained in:
Tim Hockin
2015-03-23 21:25:51 -07:00
parent c35593a717
commit 9ed6c95e8e
2 changed files with 7 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ import (
// which follows pointers and prints actual values of the nested objects
// ensuring the hash does not change when a pointer changes.
func DeepHashObject(hasher hash.Hash, objectToWrite interface{}) {
hasher.Reset()
printer := spew.ConfigState{Indent: " ", SortKeys: true}
printer.Fprintf(hasher, "%#v", objectToWrite)
}