From 9b9477b09c1ee4f402d5a487dc8ff252585785b3 Mon Sep 17 00:00:00 2001 From: Simon Sawert Date: Wed, 20 Mar 2024 23:58:15 +0100 Subject: [PATCH] feat: Add `.config` directories to `configSearchPaths` Support for `.config` proposal from https://github.com/pi0/config-dir. While walking the tree, check if a directory named `.config` exist. If so, add it to `configSearchPaths` to include when searching for `.golangci.yaml`. Fixes #4554 --- pkg/config/loader.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/config/loader.go b/pkg/config/loader.go index 782daa4c9250..20eca73fc610 100644 --- a/pkg/config/loader.go +++ b/pkg/config/loader.go @@ -138,6 +138,13 @@ func (l *Loader) setupConfigFileSearch() { for { configSearchPaths = append(configSearchPaths, curDir) + dotConfig := filepath.Join(curDir, ".config") + + info, err := os.Stat(dotConfig) + if err == nil && info.IsDir() { + configSearchPaths = append(configSearchPaths, dotConfig) + } + newCurDir := filepath.Dir(curDir) if curDir == newCurDir || newCurDir == "" { break