Defer-close the newly created config file (if does not exist)

This commit is contained in:
ayntgl 2021-09-22 00:02:59 +04:00
parent c545b4071a
commit 7d2dd4652f

View file

@ -45,6 +45,7 @@ func LoadConfig() *Config {
if err != nil {
panic(err)
}
defer f.Close()
c := Config{
Mouse: true,
@ -80,6 +81,8 @@ func LoadConfig() *Config {
}
f.Sync()
return &c
}
d, err := os.ReadFile(configPath)