sergi / go-diff

Diff, match and patch text in Go
MIT License
1.84k stars 210 forks source link

diffutils replacement #86

Open leoleovich opened 6 years ago

leoleovich commented 6 years ago

Hi there, thank you for an awesome project. Is there recommended set of functions to replace command line tool - diff and diffstat? Something, which gives output like this:

diff -u test1 test2 | diffstat -s
1 file changed, 3 insertions(+), 3 deletions(-)

As I am playing with dmp.DiffMain(test1, test2, true) and try to pass entire files as string, I get very different output, than I expect:

[{-1 very} {1 magic,} {0  } {-1 awesome} {1 in} {0  } {-1 tes} {1 fac} {0 t
with} {1  I} {0
} {-1 o} {1 be} {0 l} {-1 d and n} {1 iev} {0 e} {-1 w data} {0
}]

The test files look like this: test1:

very awesome test
with
old and new data

test2:

magic, in fact
with I
believe

Thanks in advance!