refactor: redudandant

This commit is contained in:
Slug-Boi
2025-06-17 21:02:11 +02:00
parent 9e85fdd1b9
commit b0591306f5
-3
View File
@@ -36,14 +36,11 @@ func Find_authorfile() string {
if os.Getenv("author_file") == "" { if os.Getenv("author_file") == "" {
if ConfigVar.Settings.AuthorFile != "" { if ConfigVar.Settings.AuthorFile != "" {
file = ConfigVar.Settings.AuthorFile file = ConfigVar.Settings.AuthorFile
} else if os.Getenv("author_file") != "" {
file = os.Getenv("author_file")
} else { } else {
userconf, err :=os.UserConfigDir() userconf, err :=os.UserConfigDir()
if err != nil { if err != nil {
panic(fmt.Sprintf("Error getting user config dir: %v", err)) panic(fmt.Sprintf("Error getting user config dir: %v", err))
} }
if _, err := os.Stat(userconf+"/cocommit/authors.json"); os.IsNotExist(err) { if _, err := os.Stat(userconf+"/cocommit/authors.json"); os.IsNotExist(err) {
panic(fmt.Sprintf("No author file set, please set the author_file environment variable or create a config file using the command: cocommit config -c")) panic(fmt.Sprintf("No author file set, please set the author_file environment variable or create a config file using the command: cocommit config -c"))
} else { } else {