diff options
| author | Teddy Wing | 2014-12-13 14:43:35 -0500 | 
|---|---|---|
| committer | Teddy Wing | 2014-12-13 14:43:35 -0500 | 
| commit | 8c64b8afcf6d98cefe1076ee2ec048aa75e6b4c7 (patch) | |
| tree | 996319bcacf2c1158f38213125bc9173d5acb0c7 /utils | |
| parent | b6b8d7d8b78f1c8e5de43732446051aa40673c07 (diff) | |
| download | git-checkout-history-8c64b8afcf6d98cefe1076ee2ec048aa75e6b4c7.tar.bz2 | |
utils.go: Extract branch storage filename to a variable
Stop hard-coding the storage filename.
Diffstat (limited to 'utils')
| -rw-r--r-- | utils/utils.go | 6 | 
1 files changed, 4 insertions, 2 deletions
| 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) | 
