From 8c64b8afcf6d98cefe1076ee2ec048aa75e6b4c7 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 13 Dec 2014 14:43:35 -0500 Subject: utils.go: Extract branch storage filename to a variable Stop hard-coding the storage filename. --- utils/utils.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'utils') diff --git a/utils/utils.go b/utils/utils.go index ebb67de..8efe6d2 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -9,6 +9,8 @@ import ( "gopkg.in/yaml.v2" ) +var history_file string = ".git-checkout-history" + type BranchList struct { Branches []string } @@ -22,7 +24,7 @@ func getHomeDir() string { } func OpenRCFile() (f *os.File, err error) { - file_path := getHomeDir() + "/.git-checkout-history" + file_path := getHomeDir() + "/" + history_file if _, err := os.Stat(file_path); os.IsNotExist(err) { return os.Create(file_path) } else { @@ -38,7 +40,7 @@ func Store(branch string) { } rcfile.Close() - file_path := getHomeDir() + "/.git-checkout-history" + file_path := getHomeDir() + "/" + history_file data, err := ioutil.ReadFile(file_path) if err != nil { log.Fatal(err) -- cgit v1.2.3