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/config.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/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 { |