diff options
author | Javi Fontan <jfontan@gmail.com> | 2018-03-26 23:18:54 +0200 |
---|---|---|
committer | Javi Fontan <jfontan@gmail.com> | 2018-03-27 17:32:59 +0200 |
commit | 05c414a169a75ca933402e5be19a5c4304aa4f00 (patch) | |
tree | 19dcd85c5d221cf41fa06c200423d5cc236f9f31 /plumbing/object/tree.go | |
parent | 160e6d5b654fbbaf0d9264f226c56a03f0e27d30 (diff) | |
download | go-git-05c414a169a75ca933402e5be19a5c4304aa4f00.tar.gz |
*: Use CheckClose with named returns
Previously some close errors were losts. This is specially problematic
in go-git as lots of work is done here like generating indexes and
moving packfiles.
Signed-off-by: Javi Fontan <jfontan@gmail.com>
Diffstat (limited to 'plumbing/object/tree.go')
-rw-r--r-- | plumbing/object/tree.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/plumbing/object/tree.go b/plumbing/object/tree.go index 2fcd979..c2399f8 100644 --- a/plumbing/object/tree.go +++ b/plumbing/object/tree.go @@ -233,7 +233,7 @@ func (t *Tree) Decode(o plumbing.EncodedObject) (err error) { } // Encode transforms a Tree into a plumbing.EncodedObject. -func (t *Tree) Encode(o plumbing.EncodedObject) error { +func (t *Tree) Encode(o plumbing.EncodedObject) (err error) { o.SetType(plumbing.TreeObject) w, err := o.Writer() if err != nil { @@ -242,7 +242,7 @@ func (t *Tree) Encode(o plumbing.EncodedObject) error { defer ioutil.CheckClose(w, &err) for _, entry := range t.Entries { - if _, err := fmt.Fprintf(w, "%o %s", entry.Mode, entry.Name); err != nil { + if _, err = fmt.Fprintf(w, "%o %s", entry.Mode, entry.Name); err != nil { return err } |