From 03270d3d9e11c9714786bfd7d70eef5dce12aea5 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Thu, 16 Aug 2018 16:28:06 -0400 Subject: [PATCH] *.go: clean up variable names --- compare.go | 14 ++++++++------ mtree_test.go | 19 +++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/compare.go b/compare.go index 5394832..458df85 100644 --- a/compare.go +++ b/compare.go @@ -350,16 +350,17 @@ func Compare(oldDh, newDh *DirectoryHierarchy, keys []Keyword) ([]InodeDelta, er if err != nil { return nil, err } + //fmt.Printf("new: %q\n", path) // Cannot take &kv because it's the iterator. - copy := new(Entry) - *copy = e + cEntry := new(Entry) + *cEntry = e _, ok := diffs[path] if !ok { diffs[path] = &stateT{} } - diffs[path].Old = copy + diffs[path].Old = cEntry } } } @@ -372,16 +373,17 @@ func Compare(oldDh, newDh *DirectoryHierarchy, keys []Keyword) ([]InodeDelta, er if err != nil { return nil, err } + //fmt.Printf("old: %q\n", path) // Cannot take &kv because it's the iterator. - copy := new(Entry) - *copy = e + cEntry := new(Entry) + *cEntry = e _, ok := diffs[path] if !ok { diffs[path] = &stateT{} } - diffs[path].New = copy + diffs[path].New = cEntry } } } diff --git a/mtree_test.go b/mtree_test.go index 485a9ad..882d1a9 100644 --- a/mtree_test.go +++ b/mtree_test.go @@ -4,6 +4,8 @@ import ( "io/ioutil" "os" "testing" + + "github.com/davecgh/go-spew/spew" ) var ( @@ -54,14 +56,15 @@ func TestParser(t *testing.T) { if err != nil { t.Error(err) } - /* - if i == 1 { - buf, err := xml.MarshalIndent(dh, "", " ") - if err == nil { - t.Error(string(buf)) - } - } - */ + + if i == 1 { + spew.Dump(dh) + //buf, err := xml.MarshalIndent(dh, "", " ") + //if err == nil { + //t.Error(string(buf)) + //} + } + gotNums := countTypes(dh) for typ, num := range tf.Counts { if gNum, ok := gotNums[typ]; ok {