Various adjustments to digest package for govet/golint

This commit is contained in:
Stephen J Day 2014-11-19 14:59:05 -08:00
parent 1a508d67d9
commit c0fe9d72d1
6 changed files with 26 additions and 21 deletions

View file

@ -75,8 +75,8 @@ func ParseDigest(s string) (Digest, error) {
return Digest(s), nil
}
// DigestReader returns the most valid digest for the underlying content.
func DigestReader(rd io.Reader) (Digest, error) {
// FromReader returns the most valid digest for the underlying content.
func FromReader(rd io.Reader) (Digest, error) {
// TODO(stevvooe): This is pretty inefficient to always be calculating a
// sha256 hash to provide fallback, but it provides some nice semantics in
@ -114,8 +114,9 @@ func DigestReader(rd io.Reader) (Digest, error) {
return d, nil
}
func DigestBytes(p []byte) (Digest, error) {
return DigestReader(bytes.NewReader(p))
// FromBytes digests the input and returns a Digest.
func FromBytes(p []byte) (Digest, error) {
return FromReader(bytes.NewReader(p))
}
// Algorithm returns the algorithm portion of the digest. This will panic if