diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-07-19 22:05:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-19 22:05:00 +0200 |
commit | 2d10f1023e609894174b21bdf8d3738010099335 (patch) | |
tree | 929b050b54039af69b4eae6306429feafa9d8268 /storage/filesystem/internal/dotgit/dotgit.go | |
parent | 8738a04708b91683d5804b4c648c871fdeb87f82 (diff) | |
parent | 87888eaab1caa52b6b073f610508e0f65b4141f6 (diff) | |
download | go-git-2d10f1023e609894174b21bdf8d3738010099335.tar.gz |
Merge pull request #491 from smola/error-checks
*: add more IO error checks
Diffstat (limited to 'storage/filesystem/internal/dotgit/dotgit.go')
-rw-r--r-- | storage/filesystem/internal/dotgit/dotgit.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/storage/filesystem/internal/dotgit/dotgit.go b/storage/filesystem/internal/dotgit/dotgit.go index b672d4b..e2ff51b 100644 --- a/storage/filesystem/internal/dotgit/dotgit.go +++ b/storage/filesystem/internal/dotgit/dotgit.go @@ -253,10 +253,10 @@ func (d *DotGit) SetRef(r *plumbing.Reference) error { return err } - if _, err := f.Write([]byte(content)); err != nil { - return err - } - return f.Close() + defer ioutil.CheckClose(f, &err) + + _, err = f.Write([]byte(content)) + return err } // Refs scans the git directory collecting references, which it returns. |