Skip to content

Commit

Permalink
tweak: config: check for config dir creation error
Browse files Browse the repository at this point in the history
  • Loading branch information
Contextualist committed Mar 19, 2024
1 parent 5fb5509 commit df78085
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ func getConfig() (*Config, error) {
}

func setConfig(conf *Config) error {
_ = os.MkdirAll(filepath.Dir(configFilename), 0o700)
err := os.MkdirAll(filepath.Dir(configFilename), 0o700)
if err != nil {
return fmt.Errorf("error creating config directory for %s: %v", configFilename, err)
}
configFile, err := os.Create(configFilename)
if err != nil {
return fmt.Errorf("error writing config to %s: %v", configFilename, err)
Expand Down

0 comments on commit df78085

Please sign in to comment.