commit | 8c25e6b2e03bf074f122ea68a293ff7f4061e410 | [log] [tgz] |
---|---|---|
author | Thuc Le <ledongthuc@gmail.com> | Fri May 18 08:11:24 2018 |
committer | GitHub <noreply@github.com> | Fri May 18 08:11:24 2018 |
tree | 1410e637e6ef88ec5a80015dd9ec0d3c0e0d518a | |
parent | 503023b489c905ae1af0afa9e97b27e54ee1aab1 [diff] |
Correct Go get command in document
DiffParser is a Golang package which parse's a git diff.
go get github.com/waigani/diffparser
package main import ( "fmt" "github.com/waigani/diffparser" ) // error handling left out for brevity func main() { byt, _ := ioutil.ReadFile("example.diff") diff, _ := diffparser.Parse(string(byt)) // You now have a slice of files from the diff, file := diff.Files[0] // diff hunks in the file, hunk := file.Hunks[0] // new and old ranges in the hunk newRange := hunk.NewRange // and lines in the ranges. line := newRange.Lines[0] }
See diffparser_test.go for further examples.