Skip to content

Commit da6a3e2

Browse files
authored
fix: fix config not searched at root of filesystem (#312)
1 parent 21ca532 commit da6a3e2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmd/yamlfmt/config.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,17 @@ func getConfigPathFromDirTree() (string, error) {
154154
return "", err
155155
}
156156
dir := absPath
157-
for dir != filepath.Dir(dir) {
157+
for true {
158158
configPath, err := getConfigPathFromDir(dir)
159159
if err == nil {
160160
logger.Debug(logger.DebugCodeConfig, "Found config at %s", configPath)
161161
return configPath, nil
162162
}
163+
previousDir := dir
163164
dir = filepath.Dir(dir)
165+
if dir == previousDir {
166+
break
167+
}
164168
}
165169
return "", errConfPathNotExist
166170
}

0 commit comments

Comments
 (0)