Skip to content

Commit adcd93d

Browse files
committed
fix: return fs errors on config creation
1 parent 6fdbb64 commit adcd93d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

config.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ type config struct {
2929
// empty value of Config.
3030
func newConfig(root string) (c config, err error) {
3131
filename := filepath.Join(root, ConfigFile)
32-
if _, err = os.Stat(filename); os.IsNotExist(err) {
33-
err = nil // do not consider a missing config file an error
34-
return // return the zero value of the config
32+
if _, err = os.Stat(filename); err != nil {
33+
// do not consider a missing config file an error. Just return.
34+
if os.IsNotExist(err) {
35+
err = nil
36+
}
37+
return
3538
}
3639
bb, err := ioutil.ReadFile(filename)
3740
if err != nil {

0 commit comments

Comments
 (0)