Handle non IsNotExist errors in config (#1251)

Co-authored-by: Asim Aslam <asim@aslam.me>
This commit is contained in:
ben-toogood 2020-02-24 18:07:11 +00:00 committed by GitHub
parent 5e8d5834eb
commit f1e7ea3020
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,6 +53,8 @@ func Set(key, value string) error {
// write the file if it does not exist
if _, err := os.Stat(fp); os.IsNotExist(err) {
ioutil.WriteFile(fp, []byte{}, 0644)
} else if err != nil {
return err
}
// create a new config