Fix formatting problem in sha1sum
This commit is contained in:
parent
3ffea738e6
commit
27f67edb1a
2 changed files with 7 additions and 1 deletions
|
@ -32,6 +32,12 @@ const (
|
||||||
// HashStream and MultiHasher.
|
// HashStream and MultiHasher.
|
||||||
var SupportedHashes = NewHashSet(HashMD5, HashSHA1)
|
var SupportedHashes = NewHashSet(HashMD5, HashSHA1)
|
||||||
|
|
||||||
|
// HashWidth returns the width in characters for any HashType
|
||||||
|
var HashWidth = map[HashType]int{
|
||||||
|
HashMD5: 32,
|
||||||
|
HashSHA1: 40,
|
||||||
|
}
|
||||||
|
|
||||||
// HashStream will calculate hashes of all supported hash types.
|
// HashStream will calculate hashes of all supported hash types.
|
||||||
func HashStream(r io.Reader) (map[HashType]string, error) {
|
func HashStream(r io.Reader) (map[HashType]string, error) {
|
||||||
return HashStreamTypes(r, SupportedHashes)
|
return HashStreamTypes(r, SupportedHashes)
|
||||||
|
|
|
@ -738,7 +738,7 @@ func hashLister(ht HashType, f Fs, w io.Writer) error {
|
||||||
Debug(o, "Failed to read %v: %v", ht, err)
|
Debug(o, "Failed to read %v: %v", ht, err)
|
||||||
sum = "ERROR"
|
sum = "ERROR"
|
||||||
}
|
}
|
||||||
syncFprintf(w, "%32s %s\n", sum, o.Remote())
|
syncFprintf(w, "%*s %s\n", HashWidth[ht], sum, o.Remote())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue