Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
gotextdiff
✓ github.com/hexops/gotextdiff
Compute and print a unified diff between two strings.
package main
import (
"fmt"
"github.com/hexops/gotextdiff"
"github.com/hexops/gotextdiff/myers"
)
func main() {
a := "hello\nworld"
b := "hello\ngo"
edits := myers.ComputeEdits("", a, b)
diff := fmt.Sprint(gotextdiff.ToUnified("a.txt", "b.txt", a, edits))
fmt.Println(diff)
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
1.0.3latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.