mirror of
https://github.com/spf13/cobra
synced 2024-11-24 22:57:12 +00:00
cmd: Add "-u" to output unified diff in golden tests
This commit is contained in:
parent
cb9cf94690
commit
75c6acfc8f
1 changed files with 2 additions and 2 deletions
|
@ -39,11 +39,11 @@ func compareFiles(pathA, pathB string) error {
|
||||||
// Don't execute diff if it can't be found.
|
// Don't execute diff if it can't be found.
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
diffCmd := exec.Command(diffPath, pathA, pathB)
|
diffCmd := exec.Command(diffPath, "-u", pathA, pathB)
|
||||||
diffCmd.Stdout = output
|
diffCmd.Stdout = output
|
||||||
diffCmd.Stderr = output
|
diffCmd.Stderr = output
|
||||||
|
|
||||||
output.WriteString("$ diff " + pathA + " " + pathB + "\n")
|
output.WriteString("$ diff -u " + pathA + " " + pathB + "\n")
|
||||||
if err := diffCmd.Run(); err != nil {
|
if err := diffCmd.Run(); err != nil {
|
||||||
output.WriteString("\n" + err.Error())
|
output.WriteString("\n" + err.Error())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue