#unified diff of text files

6 messages · Page 1 of 1 (latest)

high arrow
#

hi fellow gophers! I'd like to get your opinions on the topic of unified diffs (https://www.gnu.org/software/diffutils/manual/html_node/Example-Unified.html). I'd like to calculate the diff between two e.g. text files in the 'unified' format and present it in an html report I am creating in Go.

after a bit of searching, this project kept reappearing in suggestions: https://github.com/hexops/gotextdiff

do you have some suggestions for me on relevant packages?
I am slightly worried about the fact that the package I posted above has already been archived :/

GitHub

Unified text diffing in Go (copy of the internal diffing packages the officlal Go language server uses) - hexops/gotextdiff

ripe iron
#

well, this says that it's a copy of the internal diffing packages

#

so why don't you look in those and take a peek?

high arrow
#

good point actually! would this mean that I should do something like
go get golang.org/x/tools/internal/diff and I'd be able to use the internal packages in my project? or is there a different approach?

#

actually, I've just noticed that all the diff-stuff reside in the internal folder, therefore I don't expect I'd be able to use them in my project. perhaps copying the files over is the way forward?

snow rose
#

A little copying is better than a little dependency