*.go: clean up variable names

This commit is contained in:
Vincent Batts 2018-08-16 16:28:06 -04:00
parent 2f374a383e
commit 03270d3d9e
2 changed files with 19 additions and 14 deletions

View file

@ -350,16 +350,17 @@ func Compare(oldDh, newDh *DirectoryHierarchy, keys []Keyword) ([]InodeDelta, er
if err != nil { if err != nil {
return nil, err return nil, err
} }
//fmt.Printf("new: %q\n", path)
// Cannot take &kv because it's the iterator. // Cannot take &kv because it's the iterator.
copy := new(Entry) cEntry := new(Entry)
*copy = e *cEntry = e
_, ok := diffs[path] _, ok := diffs[path]
if !ok { if !ok {
diffs[path] = &stateT{} 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 { if err != nil {
return nil, err return nil, err
} }
//fmt.Printf("old: %q\n", path)
// Cannot take &kv because it's the iterator. // Cannot take &kv because it's the iterator.
copy := new(Entry) cEntry := new(Entry)
*copy = e *cEntry = e
_, ok := diffs[path] _, ok := diffs[path]
if !ok { if !ok {
diffs[path] = &stateT{} diffs[path] = &stateT{}
} }
diffs[path].New = copy diffs[path].New = cEntry
} }
} }
} }

View file

@ -4,6 +4,8 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"testing" "testing"
"github.com/davecgh/go-spew/spew"
) )
var ( var (
@ -54,14 +56,15 @@ func TestParser(t *testing.T) {
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
/*
if i == 1 { if i == 1 {
buf, err := xml.MarshalIndent(dh, "", " ") spew.Dump(dh)
if err == nil { //buf, err := xml.MarshalIndent(dh, "", " ")
t.Error(string(buf)) //if err == nil {
} //t.Error(string(buf))
} //}
*/ }
gotNums := countTypes(dh) gotNums := countTypes(dh)
for typ, num := range tf.Counts { for typ, num := range tf.Counts {
if gNum, ok := gotNums[typ]; ok { if gNum, ok := gotNums[typ]; ok {