Skip to content

Commit

Permalink
feat: Add .config directories to configSearchPaths
Browse files Browse the repository at this point in the history
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 golangci#4554
  • Loading branch information
bombsimon committed Mar 20, 2024
1 parent 9558299 commit 9b9477b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/config/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9b9477b

Please sign in to comment.