Merge branch 'coryrc-fix-merge-with-dots' into compare

This commit is contained in:
Mike Farah 2020-02-07 09:10:25 +11:00
commit 63313ebb02
3 changed files with 14 additions and 6 deletions

View File

@ -1525,7 +1525,7 @@ c:
toast: leave
test: 1
tell: 1
taco: cool
tasty.taco: cool
`
filename := test.WriteTempYamlFile(content)
defer test.RemoveTempYamlFile(filename)
@ -1540,7 +1540,7 @@ c:
b: [3, 4]
c:
toast: leave
taco: cool
tasty.taco: cool
`
test.AssertResult(t, expectedOutput, result.Output)
}
@ -1706,7 +1706,7 @@ c:
test: 1
toast: leave
tell: 1
taco: cool
tasty.taco: cool
`
test.AssertResult(t, expectedOutput, result.Output)
}
@ -1921,7 +1921,7 @@ c:
test: 1
toast: leave
tell: 1
taco: cool
tasty.taco: cool
`
test.AssertResult(t, expectedOutput, gotOutput)
test.AssertResult(t, os.FileMode(int(0666)), info.Mode())

View File

@ -4,4 +4,4 @@ c:
toast: leave
test: 1
tell: 1
taco: cool
tasty.taco: cool

View File

@ -51,7 +51,15 @@ func mergePathStackToString(pathStack []interface{}, appendArrays bool) string {
}
default:
sb.WriteString(fmt.Sprintf("%v", path))
s := fmt.Sprintf("%v", path)
hasDot := strings.Contains(s, ".")
if hasDot {
sb.WriteString("[")
}
sb.WriteString(s)
if hasDot {
sb.WriteString("]")
}
}
if index < len(pathStack)-1 {