From f0cf3e12b66b6bbea7402e7ff1116c4e819656fc Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Wed, 31 Mar 2021 00:18:00 -0500 Subject: [PATCH] Declare variables at the top of function --- cmd/config.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/config.go b/cmd/config.go index 4dce1a7..1dc5312 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -110,10 +110,11 @@ func LoadConfigFile(configPath string) (*Config, error) { } func getConfigPath() string { - var tryPath, configPath string + var tryPath, configPath, homeDir, cwd string + var err error // ~/.lumerc - homeDir, err := os.UserHomeDir() + homeDir, err = os.UserHomeDir() if err == nil { tryPath = path.Join(homeDir, lumercFile) if _, err := os.Stat(tryPath); !os.IsNotExist(err) { @@ -122,7 +123,7 @@ func getConfigPath() string { } // ./.lumerc - cwd, err := os.Getwd() + cwd, err = os.Getwd() if err == nil { tryPath = path.Join(cwd, lumercFile) if _, err := os.Stat(tryPath); !os.IsNotExist(err) {