Closed Taark closed 3 years ago
Answer:
package main
import (
"fmt"
"github.com/sergi/go-diff/diffmatchpatch"
)
func main() {
dmp := diffmatchpatch.New()
text1 := "some text"
text2 := "other text"
diffs := dmp.DiffMain(text1, text2, true)
fmt.Println(dmp.DiffCleanupSemantic(diffs))
}
I apologize for the stupid question.
How to get get diff by words? Example: text1 := "some text" text2 := "other text" ... output []Diff: {Delete: some} {Insert: other} {Equal: text}
P.S. Sorry for my English.