builds again

This commit is contained in:
Jeffrey Paul 2019-09-26 15:47:04 -07:00
parent 5b1ba9a3f2
commit 1e45ea3e24

29
main.go
View File

@ -14,6 +14,7 @@ import "os"
import "io"
import "flag"
import "time"
import "strconv"
var Version string
var Buildtime string
@ -144,7 +145,7 @@ func HashFile(fp *os.File) (string, error) {
return "", err
}
mHashBuf, err := multihash.EncodeName(h.Sum(nil), "sha1")
mHashBuf, err := multihash.EncodeName(h.Sum(nil), "sha2-256")
if err != nil {
return "", err
@ -161,9 +162,12 @@ type xsf struct {
fi *os.FileInfo
fp *os.File
multihash string
xmultihash string
mtime string
xmtime string
path string
size int64
size uint64
xsize uint64
}
/////////////////////////////////////////////////////////////////////////////////
@ -184,13 +188,32 @@ func (x *xsf) readXattrs(fp *os.File) error {
xn = fmt.Sprintf("%s.%s", namespacePrefix, "mtime")
v, err = xattr.FGet(x.fp, xn)
if err != nil {
return err
}
x.xmtime = string(v)
xn = fmt.Sprintf("%s.%s", namespacePrefix, "size")
v, err = xattr.FGet(x.fp, xn)
if err != nil {
return err
}
a, b := strconv.ParseInt(string(v), 10, 64)
if b != nil {
return b
}
x.xsize = uint64(a)
xn = fmt.Sprintf("%s.%s", namespacePrefix, "multihash")
v, err = xattr.FGet(x.fp, xn)
if err != nil {
return err
}
x.xmultihash = string(v)
return nil //FIXME
}
@ -229,7 +252,7 @@ func (x *xsf) stat(fp *os.File) error {
if err != nil {
return err
}
x.size = fi.Size()
x.size = uint64(fi.Size())
log.Debugf("size: %d", x.size)
t := fi.ModTime().UTC().Format(time.RFC3339)
log.Debugf("modtime: %s", t)