package main
import (
+ "bytes"
+ "encoding/hex"
"errors"
"io"
"io/fs"
if err != nil {
return ErrLine(err)
}
- theirHsh := m["Hash"]
+ theirHsh := mustHexDecode(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 != theirHsh {
+ if !bytes.Equal(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: hsh},
+ {Name: "Hash", Value: hex.EncodeToString(hsh)},
}
fields = append(fields, inode.RecfileFields()...)
fieldses[len(fieldses)-1] = fields