From 4f169db6d7fc5ccd9bf2055c16d2a79b342190bd Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Fri, 6 Oct 2023 21:36:34 +0300 Subject: [PATCH] Move Hash-related code to separate file --- dep.go | 8 -------- hash.go | 13 +++++++++++++ 2 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 hash.go 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)) +} -- 2.44.0