pkg / diff

BSD 3-Clause "New" or "Revised" License
88 stars 9 forks source link

expose means of working with EditScripts directly #15

Closed josharian closed 5 years ago

josharian commented 5 years ago

I originally wrote this package because I wanted access to the guts of a diff, not just a printed representation of it. I hid the API for it for initial release.

I now find myself wanting access again. For the moment, I've locally exported some stuff as-is. See https://github.com/pkg/diff/commit/fae18f594be8c3b147584560c8705ece77f177e7 for details.

Question: Should we expose these nuts and bolts as-is? Should we provide accessors to (say) walk an edit script and emit a series of insertions, deletions, and equalities? (WriteUnified could be implemented using such a walk function.)

Opinions, @mvdan ?

mvdan commented 5 years ago

I think exposing these internals is fine, but I'd recommend a separate package if the amount of API they'd expose on the godoc would be a majority of the total.