Skip to content

Commit

Permalink
Merge pull request #325 from testwill/close_files
Browse files Browse the repository at this point in the history
fix: close files
  • Loading branch information
birdayz committed May 8, 2024
2 parents 4a071a9 + e7e3177 commit 29732f2
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 29732f2

Please sign in to comment.