aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format
diff options
context:
space:
mode:
authorSantiago M. Mola <santi@mola.io>2017-03-03 16:12:26 +0100
committerGitHub <noreply@github.com>2017-03-03 16:12:26 +0100
commit047a795df6d5a0d5dd0782297cea918e4a4a6e10 (patch)
tree21cb0eead9f6251558e317495418dcbd09614e2a /plumbing/format
parent59335b69777f2ef311e63b7d3464459a3ac51d48 (diff)
parent5bf511770f27a14def9d59c375b82c51ab34ba25 (diff)
downloadgo-git-047a795df6d5a0d5dd0782297cea918e4a4a6e10.tar.gz
Merge pull request #299 from ajnavarro/fix/read-all
Return values of Read not checked (fix #65)
Diffstat (limited to 'plumbing/format')
-rw-r--r--plumbing/format/idxfile/decoder.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/plumbing/format/idxfile/decoder.go b/plumbing/format/idxfile/decoder.go
index 020c997..c1269a1 100644
--- a/plumbing/format/idxfile/decoder.go
+++ b/plumbing/format/idxfile/decoder.go
@@ -57,7 +57,7 @@ func (d *Decoder) Decode(idx *Idxfile) error {
func validateHeader(r io.Reader) error {
var h = make([]byte, 4)
- if _, err := r.Read(h); err != nil {
+ if _, err := io.ReadFull(r, h); err != nil {
return err
}
@@ -99,7 +99,7 @@ func readObjectNames(idx *Idxfile, r io.Reader) error {
c := int(idx.ObjectCount)
for i := 0; i < c; i++ {
var ref plumbing.Hash
- if _, err := r.Read(ref[:]); err != nil {
+ if _, err := io.ReadFull(r, ref[:]); err != nil {
return err
}
@@ -135,11 +135,11 @@ func readOffsets(idx *Idxfile, r io.Reader) error {
}
func readChecksums(idx *Idxfile, r io.Reader) error {
- if _, err := r.Read(idx.PackfileChecksum[:]); err != nil {
+ if _, err := io.ReadFull(r, idx.PackfileChecksum[:]); err != nil {
return err
}
- if _, err := r.Read(idx.IdxChecksum[:]); err != nil {
+ if _, err := io.ReadFull(r, idx.IdxChecksum[:]); err != nil {
return err
}