aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/tree.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2018-04-02 10:39:47 +0200
committerGitHub <noreply@github.com>2018-04-02 10:39:47 +0200
commit0c2618bc7d495322c6413b0ff62549712747cf9e (patch)
tree03ddc67b73733d0582367e9038c454353fa55955 /plumbing/object/tree.go
parent160e6d5b654fbbaf0d9264f226c56a03f0e27d30 (diff)
parent6e07548d9078505ca2945f09d11729b14abcc907 (diff)
downloadgo-git-0c2618bc7d495322c6413b0ff62549712747cf9e.tar.gz
Merge pull request #794 from jfontan/fix/checkclose
Use CheckClose with named returns and fix tests
Diffstat (limited to 'plumbing/object/tree.go')
-rw-r--r--plumbing/object/tree.go4
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
}