From 0aeb86cafbbeee680d227e694507dcea0c19c683 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 31 Jul 2025 20:18:43 +0100 Subject: [PATCH] Refactor --- main.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 5b6d42f..e5a7eae 100644 --- a/main.go +++ b/main.go @@ -12,15 +12,20 @@ type Config struct { Directories []string `yaml:"directories"` } -func main() { +func getConfigPath() string { home, err := os.UserHomeDir() + if err != nil { panic(err) } - configPath := filepath.Join(home, ".config", "git-repo-updater", "config.yaml") + return filepath.Join(home, ".config", "git-repo-updater", "config.yaml") +} +func main() { + configPath := getConfigPath() data, err := os.ReadFile(configPath) + if err != nil { panic(err) }