From 80d31913f5b317a287215b69f2f9c5f343a2e252 Mon Sep 17 00:00:00 2001 From: "Furukawa, Atsushi" Date: Sat, 23 Dec 2023 01:19:05 +0900 Subject: [PATCH] chore: fix utils/utils.go / repoDir (#63) * chore: fix utils/utils.go / repoDir - first, reference $XDG_CACHE_HOME directory to All OS's cache directory - fix: change save directory gibo to gibo/gitignore-boilerplates - fix: compare string change == to string.equalFold * fix: remove XDG_Base from 1st use --------- Co-authored-by: Simon Whitaker --- utils/utils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/utils.go b/utils/utils.go index 2ce7bd8..22cf4d4 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -18,7 +18,7 @@ func RepoDir() string { if err != nil { log.Fatalln("gibo can't determine your user cache directory. Please file an issue at https://github.com/simonwhitaker/gibo/issues") } - return filepath.Join(cacheDir, "gibo") + return filepath.Join(cacheDir, "gibo", "gitignore-boilerplates") } func cloneRepo(repo string) error { @@ -56,7 +56,7 @@ func pathForBoilerplate(name string) (string, error) { filename := name + ".gitignore" var result string = "" filepath.WalkDir(RepoDir(), func(path string, d fs.DirEntry, err error) error { - if strings.ToLower(filepath.Base(path)) == strings.ToLower(filename) { + if strings.EqualFold(filepath.Base(path), filename) { result = path // Exit WalkDir early, we've found our match return filepath.SkipAll