From adcd93d70cf146eb93da635716a85412792a27ac Mon Sep 17 00:00:00 2001 From: Luke K Date: Sat, 29 Aug 2020 01:20:39 +0900 Subject: [PATCH] fix: return fs errors on config creation --- config.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/config.go b/config.go index 80afe6b0..19e8ba10 100644 --- a/config.go +++ b/config.go @@ -29,9 +29,12 @@ type config struct { // empty value of Config. func newConfig(root string) (c config, err error) { filename := filepath.Join(root, ConfigFile) - if _, err = os.Stat(filename); os.IsNotExist(err) { - err = nil // do not consider a missing config file an error - return // return the zero value of the config + if _, err = os.Stat(filename); err != nil { + // do not consider a missing config file an error. Just return. + if os.IsNotExist(err) { + err = nil + } + return } bb, err := ioutil.ReadFile(filename) if err != nil {