diff options
author | emersion <contact@emersion.fr> | 2018-01-10 17:19:45 +0100 |
---|---|---|
committer | Drew DeVault <ddevault@vistarmedia.com> | 2018-01-10 11:20:41 -0500 |
commit | a0be5e80256b98237241b2f3d7825484e7a9c964 (patch) | |
tree | 8387b8abc2ad9a81c1ced0d1caa50be7b987e193 /config/config.go | |
parent | 305446abfd66e85fe2c46cb4a07a3abb9fa809a4 (diff) | |
download | aerc-a0be5e80256b98237241b2f3d7825484e7a9c964.tar.gz |
Misc idiomatic fixes
Diffstat (limited to 'config/config.go')
-rw-r--r-- | config/config.go | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/config/config.go b/config/config.go index a7e9d84..142a1e0 100644 --- a/config/config.go +++ b/config/config.go @@ -1,13 +1,13 @@ package config import ( - "github.com/go-ini/ini" - "github.com/kyoh86/xdg" - "fmt" "path" "strings" "unicode" + + "github.com/go-ini/ini" + "github.com/kyoh86/xdg" ) type UIConfig struct { @@ -50,16 +50,13 @@ func mapName(raw string) string { } func loadAccountConfig(path string) ([]AccountConfig, error) { - var ( - file *ini.File - err error - accounts []AccountConfig - ) - accounts = make([]AccountConfig, 0) - if file, err = ini.Load(path); err != nil { + file, err := ini.Load(path) + if err != nil { return nil, err } file.NameMapper = mapName + + var accounts []AccountConfig for _, _sec := range file.SectionStrings() { if _sec == "DEFAULT" { continue @@ -87,15 +84,12 @@ func loadAccountConfig(path string) ([]AccountConfig, error) { } func LoadConfig(root *string) (*AercConfig, error) { - var ( - err error - file *ini.File - ) if root == nil { _root := path.Join(xdg.ConfigHome(), "aerc") root = &_root } - if file, err = ini.Load(path.Join(*root, "aerc.conf")); err != nil { + file, err := ini.Load(path.Join(*root, "aerc.conf")) + if err != nil { return nil, err } file.NameMapper = mapName |