From 87888eaab1caa52b6b073f610508e0f65b4141f6 Mon Sep 17 00:00:00 2001 From: "Santiago M. Mola" Date: Wed, 19 Jul 2017 12:59:16 +0200 Subject: storage/filesystem: check all Close errors --- storage/filesystem/config.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'storage/filesystem/config.go') diff --git a/storage/filesystem/config.go b/storage/filesystem/config.go index cad698a..a2cc173 100644 --- a/storage/filesystem/config.go +++ b/storage/filesystem/config.go @@ -1,11 +1,12 @@ package filesystem import ( - "io/ioutil" + stdioutil "io/ioutil" "os" "gopkg.in/src-d/go-git.v4/config" "gopkg.in/src-d/go-git.v4/storage/filesystem/internal/dotgit" + "gopkg.in/src-d/go-git.v4/utils/ioutil" ) type ConfigStorage struct { @@ -24,9 +25,9 @@ func (c *ConfigStorage) Config() (*config.Config, error) { return nil, err } - defer f.Close() + defer ioutil.CheckClose(f, &err) - b, err := ioutil.ReadAll(f) + b, err := stdioutil.ReadAll(f) if err != nil { return nil, err } @@ -35,7 +36,7 @@ func (c *ConfigStorage) Config() (*config.Config, error) { return nil, err } - return cfg, nil + return cfg, err } func (c *ConfigStorage) SetConfig(cfg *config.Config) error { @@ -48,7 +49,7 @@ func (c *ConfigStorage) SetConfig(cfg *config.Config) error { return err } - defer f.Close() + defer ioutil.CheckClose(f, &err) b, err := cfg.Marshal() if err != nil { -- cgit