diff --git a/base/base.go b/base/base.go index eb23216..3a39e64 100644 --- a/base/base.go +++ b/base/base.go @@ -9,7 +9,8 @@ import ( "os" "path/filepath" - "../file" + "github.com/vbatts/dedupe-linker/cryptomap" + "github.com/vbatts/dedupe-linker/file" ) func NewBase(path string, hashName string) (*Base, error) { @@ -19,7 +20,7 @@ func NewBase(path string, hashName string) (*Base, error) { return nil, err } } - return &Base{Path: root, HashName: hashName}, nil + return &Base{Path: root, HashName: hashName, Hash: cryptomap.DetermineHash(hashName)}, nil } type Base struct { diff --git a/base/base_test.go b/base/base_test.go index 336f997..f7ce4f6 100644 --- a/base/base_test.go +++ b/base/base_test.go @@ -63,4 +63,8 @@ func TestGetPut(t *testing.T) { if err = b.LinkTo(path.Join(srcDir, "beef1.txt"), rHash); err != nil && !os.IsExist(err) { t.Error(err) } + + if rHash != sum { + t.Errorf("expected %s; got %s", rHash, sum) + } } diff --git a/main.go b/main.go index 2262c1f..08fdb28 100644 --- a/main.go +++ b/main.go @@ -8,9 +8,9 @@ import ( "path/filepath" "runtime" - "./base" - "./cryptomap" - "./file" + "github.com/vbatts/dedupe-linker/base" + "github.com/vbatts/dedupe-linker/cryptomap" + "github.com/vbatts/dedupe-linker/file" ) var ( diff --git a/walker/walker.go b/walker/walker.go index f65b553..ef94516 100644 --- a/walker/walker.go +++ b/walker/walker.go @@ -1,7 +1,7 @@ package walker import ( - "./base" + "github.com/vbatts/dedupe-linker/base" ) type Walker struct {