Make tiny variable optimization #1

Merged
restitux merged 1 commits from edwargix/config:varoptimize into main 2022-10-02 00:56:47 +00:00
+4 -9
View File
@@ -19,16 +19,11 @@ func getConfigDir(n string) string {
// Find config directory
// Linux (XDG base directory specification compliant)
xdg_config_home := os.Getenv("XDG_CONFIG_HOME")
var base string
if xdg_config_home != "" {
base = xdg_config_home
} else {
home := os.Getenv("HOME")
base = filepath.Join(home, ".config")
if xdg_config_home := os.Getenv("XDG_CONFIG_HOME"); xdg_config_home != "" {
return filepath.Join(xdg_config_home, n)
}
return filepath.Join(base, n)
return filepath.Join(os.Getenv("HOME"), ".config", n)
}
func (c *Config[T]) Get() (bool, error) {