|
1 | 1 | go-difflib
|
2 | 2 | ==========
|
3 | 3 |
|
4 |
| -THIS PACKAGE IS NO LONGER MAINTAINED. |
| 4 | +The previous owner of this project (pmezard) did not have the time to continue |
| 5 | +working on it. Additionally I (ianbruene) needed additional ported features. |
5 | 6 |
|
6 |
| -At this point, I have no longer the time nor the interest to work on go-difflib. I apologize for the inconvenience. |
| 7 | +I have taken over maintenance and further development of the project |
7 | 8 |
|
8 |
| -[](https://godoc.org/github.com/pmezard/go-difflib/difflib) |
| 9 | +[](https://godoc.org/github.com/ianbruene/go-difflib/difflib) |
9 | 10 |
|
10 | 11 | Go-difflib is a partial port of python 3 difflib package. Its main goal
|
11 |
| -was to make unified and context diff available in pure Go, mostly for |
12 |
| -testing purposes. |
| 12 | +is to make unified and context diff available in pure Go. |
13 | 13 |
|
14 | 14 | The following class and functions (and related tests) have be ported:
|
15 | 15 |
|
16 | 16 | * `SequenceMatcher`
|
| 17 | +* `Differ` |
17 | 18 | * `unified_diff()`
|
18 | 19 | * `context_diff()`
|
19 | 20 |
|
20 | 21 | ## Installation
|
21 | 22 |
|
22 | 23 | ```bash
|
23 |
| -$ go get github.com/pmezard/go-difflib/difflib |
| 24 | +$ go get github.com/ianbruene/go-difflib/difflib |
24 | 25 | ```
|
25 | 26 |
|
26 |
| -### Quick Start |
| 27 | +### UnifiedDiff Quick Start |
27 | 28 |
|
28 | 29 | Diffs are configured with Unified (or ContextDiff) structures, and can
|
29 | 30 | be output to an io.Writer or returned as a string.
|
@@ -51,3 +52,23 @@ would output:
|
51 | 52 | +baz
|
52 | 53 | ```
|
53 | 54 |
|
| 55 | +### Differ Quick Start |
| 56 | + |
| 57 | +Differ has been implemented primarily for the Compare() function at this time. |
| 58 | + |
| 59 | +```Go |
| 60 | +out, err := diff.Compare( |
| 61 | + []string{"foo\n", "bar\n", "baz\n"}, |
| 62 | + []string{"foo\n", "bar1\n", "asdf\n", "baz\n"}) |
| 63 | +``` |
| 64 | + |
| 65 | +would output: |
| 66 | + |
| 67 | +``` |
| 68 | + foo |
| 69 | +- bar |
| 70 | ++ bar1 |
| 71 | +? + |
| 72 | ++ asdf |
| 73 | + baz |
| 74 | +``` |
0 commit comments