]> Cypherpunks.ru repositories - goredo.git/commitdiff
Move Hash-related code to separate file
authorSergey Matveev <stargrave@stargrave.org>
Fri, 6 Oct 2023 18:36:34 +0000 (21:36 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 6 Oct 2023 18:48:31 +0000 (21:48 +0300)
dep.go
hash.go [new file with mode: 0644]

diff --git a/dep.go b/dep.go
index a1e45ae62c0d8cb013e1abe26ca5a7b47f375727..4d57c917b3e5fe75f360653030e754b4d081ba77 100644 (file)
--- 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 (file)
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))
+}