]> Cypherpunks.ru repositories - goredo.git/blobdiff - depfix.go
Hash explicit type
[goredo.git] / depfix.go
index 87ecd882961cf8026d2398dc0dcf4a96bbbac2c9..bc4452cef820c3a40b507bd860ec9094be701d5a 100644 (file)
--- a/depfix.go
+++ b/depfix.go
@@ -18,7 +18,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 package main
 
 import (
-       "encoding/hex"
        "errors"
        "io"
        "io/fs"
@@ -111,7 +110,7 @@ func depFix(root string) error {
                                if err != nil {
                                        return ErrLine(err)
                                }
-                               theirHsh := mustHexDecode(m["Hash"])
+                               theirHsh := mustHashDecode(m["Hash"])
                                fd, err := os.Open(path.Join(root, dep))
                                if err != nil {
                                        if errors.Is(err, fs.ErrNotExist) {
@@ -149,7 +148,7 @@ func depFix(root string) error {
                                if err != nil {
                                        return ErrLine(err)
                                }
-                               if hsh != string(theirHsh) {
+                               if hsh != theirHsh {
                                        tracef(
                                                CDebug, "depfix: %s/%s -> %s: hash differs",
                                                root, entry.Name(), dep,
@@ -159,7 +158,7 @@ func depFix(root string) error {
                                fields = []recfile.Field{
                                        {Name: "Type", Value: DepTypeIfchange},
                                        {Name: "Target", Value: dep},
-                                       {Name: "Hash", Value: hex.EncodeToString([]byte(hsh))},
+                                       {Name: "Hash", Value: hsh.String()},
                                }
                                fields = append(fields, inode.RecfileFields()...)
                                fieldses[len(fieldses)-1] = fields