12247: Simplify (Hash)Sum() usage.
authorTom Clegg <tclegg@veritasgenetics.com>
Tue, 19 Sep 2017 14:47:06 +0000 (10:47 -0400)
committerTom Clegg <tclegg@veritasgenetics.com>
Tue, 19 Sep 2017 14:47:06 +0000 (10:47 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>

sdk/go/keepclient/hashcheck.go

index 9b13eda771afcf9a3ac523454a7f2163a67864e4..726b81362ca6d4e9b1db43f6f8677111039911b3 100644 (file)
@@ -35,7 +35,7 @@ func (this HashCheckingReader) Read(p []byte) (n int, err error) {
                this.Hash.Write(p[:n])
        }
        if err == io.EOF {
-               sum := this.Hash.Sum(make([]byte, 0, this.Hash.Size()))
+               sum := this.Hash.Sum(nil)
                if fmt.Sprintf("%x", sum) != this.Check {
                        err = BadChecksum
                }
@@ -57,7 +57,7 @@ func (this HashCheckingReader) WriteTo(dest io.Writer) (written int64, err error
                return written, err
        }
 
-       sum := this.Hash.Sum(make([]byte, 0, this.Hash.Size()))
+       sum := this.Hash.Sum(nil)
        if fmt.Sprintf("%x", sum) != this.Check {
                return written, BadChecksum
        }
@@ -81,7 +81,7 @@ func (this HashCheckingReader) Close() (err error) {
                return err
        }
 
-       sum := this.Hash.Sum(make([]byte, 0, this.Hash.Size()))
+       sum := this.Hash.Sum(nil)
        if fmt.Sprintf("%x", sum) != this.Check {
                err = BadChecksum
        }