mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
Improve testing error messaging when comparing files
This commit is contained in:
@@ -6,11 +6,13 @@ package copyutil
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/sergi/go-diff/diffmatchpatch"
|
||||||
"sigs.k8s.io/kustomize/kyaml/sets"
|
"sigs.k8s.io/kustomize/kyaml/sets"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -119,6 +121,9 @@ func Diff(sourceDir, destDir string) (sets.String, error) {
|
|||||||
return diff, err
|
return diff, err
|
||||||
}
|
}
|
||||||
if !bytes.Equal(b1, b2) {
|
if !bytes.Equal(b1, b2) {
|
||||||
|
dmp := diffmatchpatch.New()
|
||||||
|
diffs := dmp.DiffMain(string(b1), string(b2), false)
|
||||||
|
fmt.Println(dmp.DiffPrettyText(diffs))
|
||||||
diff.Insert(f)
|
diff.Insert(f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user