From: Sergey Matveev Date: Fri, 6 Oct 2023 18:36:34 +0000 (+0300) Subject: Move Hash-related code to separate file X-Git-Tag: v2.0.0~16 X-Git-Url: http://www.git.cypherpunks.ru/?p=goredo.git;a=commitdiff_plain;h=4f169db6d7fc5ccd9bf2055c16d2a79b342190bd Move Hash-related code to separate file --- diff --git a/dep.go b/dep.go index a1e45ae..4d57c91 100644 --- a/dep.go +++ b/dep.go @@ -33,8 +33,6 @@ import ( "lukechampine.com/blake3" ) -const HashLen = 32 - var ( DirPrefix string DepCwd string @@ -44,12 +42,6 @@ var ( HashCache = make(map[string][]Hash) ) -type Hash string - -func (h Hash) String() string { - return hex.EncodeToString([]byte(h)) -} - func recfileWrite(fdDep io.StringWriter, fields ...recfile.Field) error { w := recfile.NewWriter(fdDep) if _, err := w.RecordStart(); err != nil { diff --git a/hash.go b/hash.go new file mode 100644 index 0000000..420937d --- /dev/null +++ b/hash.go @@ -0,0 +1,13 @@ +package main + +import ( + "encoding/hex" +) + +const HashLen = 32 + +type Hash string + +func (h Hash) String() string { + return hex.EncodeToString([]byte(h)) +}