Declare variables at the top of function

This commit is contained in:
Ryan Cavicchioni 2021-03-31 00:18:00 -05:00
parent ce5f14db5d
commit f0cf3e12b6
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D

View File

@ -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) {