From 2fd840c0e961ee8f21e8a2e06ff6d9bb08802c7a Mon Sep 17 00:00:00 2001 From: Ian Howell Date: Tue, 26 Feb 2019 08:53:32 -0600 Subject: [PATCH] Add comments to appease the linter Signed-off-by: Ian Howell --- pkg/helm/environment/default_home_dir.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/helm/environment/default_home_dir.go b/pkg/helm/environment/default_home_dir.go index 3f9202ff0..d3483d524 100644 --- a/pkg/helm/environment/default_home_dir.go +++ b/pkg/helm/environment/default_home_dir.go @@ -32,11 +32,13 @@ var defaultHelmHome = xdg.App{Name: "helm"}.ConfigPath("") // Old default helm home, it's old good $HELM/.helm var oldDefaultHelmHome = filepath.Join(homedir.HomeDir(), ".helm") +// DefaultConfigHomePath is an interface with functionality for checking existence of default dirs type DefaultConfigHomePath interface { xdgHomeExists() bool basicHomeExists() bool } +// FSConfigHomePath is an implementation of DefaultConfigHomePath type FSConfigHomePath struct{ DefaultConfigHomePath } // Checks whether $XDG_CONFIG_HOME/helm exists @@ -49,14 +51,16 @@ func (FSConfigHomePath) basicHomeExists() bool { return DirExists(oldDefaultHelmHome) } +// ConfigPath is used to check the existsence of the default dirs var ConfigPath DefaultConfigHomePath = FSConfigHomePath{} +// DirExists is a utility function for checking for directory existence func DirExists(path string) bool { osStat, err := os.Stat(path) return err == nil && osStat.IsDir() } -// Get configuration home dir. +// GetDefaultConfigHome determines the configuration home dir. func GetDefaultConfigHome() string { if ConfigPath.xdgHomeExists() || !ConfigPath.basicHomeExists() { return defaultHelmHome