package main
import (
- "encoding/hex"
"errors"
"io"
"io/fs"
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) {
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,
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