Add comments to appease the linter

Signed-off-by: Ian Howell <ian.howell0@gmail.com>
pull/5166/head
Ian Howell 7 years ago committed by Alexander Nesterenko
parent 1c20b0a856
commit 2fd840c0e9

@ -32,11 +32,13 @@ var defaultHelmHome = xdg.App{Name: "helm"}.ConfigPath("")
// Old default helm home, it's old good $HELM/.helm // Old default helm home, it's old good $HELM/.helm
var oldDefaultHelmHome = filepath.Join(homedir.HomeDir(), ".helm") var oldDefaultHelmHome = filepath.Join(homedir.HomeDir(), ".helm")
// DefaultConfigHomePath is an interface with functionality for checking existence of default dirs
type DefaultConfigHomePath interface { type DefaultConfigHomePath interface {
xdgHomeExists() bool xdgHomeExists() bool
basicHomeExists() bool basicHomeExists() bool
} }
// FSConfigHomePath is an implementation of DefaultConfigHomePath
type FSConfigHomePath struct{ DefaultConfigHomePath } type FSConfigHomePath struct{ DefaultConfigHomePath }
// Checks whether $XDG_CONFIG_HOME/helm exists // Checks whether $XDG_CONFIG_HOME/helm exists
@ -49,14 +51,16 @@ func (FSConfigHomePath) basicHomeExists() bool {
return DirExists(oldDefaultHelmHome) return DirExists(oldDefaultHelmHome)
} }
// ConfigPath is used to check the existsence of the default dirs
var ConfigPath DefaultConfigHomePath = FSConfigHomePath{} var ConfigPath DefaultConfigHomePath = FSConfigHomePath{}
// DirExists is a utility function for checking for directory existence
func DirExists(path string) bool { func DirExists(path string) bool {
osStat, err := os.Stat(path) osStat, err := os.Stat(path)
return err == nil && osStat.IsDir() return err == nil && osStat.IsDir()
} }
// Get configuration home dir. // GetDefaultConfigHome determines the configuration home dir.
func GetDefaultConfigHome() string { func GetDefaultConfigHome() string {
if ConfigPath.xdgHomeExists() || !ConfigPath.basicHomeExists() { if ConfigPath.xdgHomeExists() || !ConfigPath.basicHomeExists() {
return defaultHelmHome return defaultHelmHome

Loading…
Cancel
Save