diff options
author | Santiago M. Mola <santi@mola.io> | 2017-07-19 12:59:16 +0200 |
---|---|---|
committer | Santiago M. Mola <santi@mola.io> | 2017-07-19 14:48:46 +0200 |
commit | 87888eaab1caa52b6b073f610508e0f65b4141f6 (patch) | |
tree | 1ddaa824f7baa26350aa50607877d4bf9e207f13 /storage/filesystem/config.go | |
parent | ebc25df06ce7d11afe88339af7bb097926599b7d (diff) | |
download | go-git-87888eaab1caa52b6b073f610508e0f65b4141f6.tar.gz |
storage/filesystem: check all Close errors
Diffstat (limited to 'storage/filesystem/config.go')
-rw-r--r-- | storage/filesystem/config.go | 11 |
1 files changed, 6 insertions, 5 deletions
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 { |