Skip to content

Commit

Permalink
fix: close files
Browse files Browse the repository at this point in the history
  • Loading branch information
testwill committed May 8, 2024
1 parent 4a071a9 commit e7e3177
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func (c *Config) Write() error {
if err != nil {
panic(err)
}
defer file.Close()

encoder := yaml.NewEncoder(file)
return encoder.Encode(&c)
Expand All @@ -126,6 +127,7 @@ func ReadConfig(cfgPath string) (c Config, err error) {
}
return Config{}, err
}
defer file.Close()
decoder := yaml.NewDecoder(file)
err = decoder.Decode(&c)
if err != nil {
Expand Down

0 comments on commit e7e3177

Please sign in to comment.