{"id":13511644,"url":"https://github.com/sergi/go-diff","last_synced_at":"2025-04-23T18:58:19.079Z","repository":{"id":5928138,"uuid":"7148036","full_name":"sergi/go-diff","owner":"sergi","description":"Diff, match and patch text in Go","archived":false,"fork":false,"pushed_at":"2024-07-18T05:54:08.000Z","size":1637,"stargazers_count":1920,"open_issues_count":37,"forks_count":217,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-04-23T18:58:11.993Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sergi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-12-13T12:41:02.000Z","updated_at":"2025-04-23T11:53:56.000Z","dependencies_parsed_at":"2023-02-12T14:15:44.339Z","dependency_job_id":"91e374d4-5b20-4a2d-a67b-62602fc1af63","html_url":"https://github.com/sergi/go-diff","commit_stats":{"total_commits":170,"total_committers":30,"mean_commits":5.666666666666667,"dds":0.7176470588235294,"last_synced_commit":"5b0b94c5c0d3d261e044521f7f46479ef869cf76"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergi%2Fgo-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergi%2Fgo-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergi%2Fgo-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergi%2Fgo-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sergi","download_url":"https://codeload.github.com/sergi/go-diff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250496976,"owners_count":21440231,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T03:01:02.961Z","updated_at":"2025-04-23T18:58:19.045Z","avatar_url":"https://github.com/sergi.png","language":"Go","funding_links":[],"categories":["Misc","开源类库","Go","Open source library","Static Code Analysis"],"sub_categories":["文本处理","Word Processing"],"readme":"# go-diff [![GoDoc](https://godoc.org/github.com/sergi/go-diff?status.png)](https://godoc.org/github.com/sergi/go-diff/diffmatchpatch) [![Build Status](https://travis-ci.org/sergi/go-diff.svg?branch=master)](https://travis-ci.org/sergi/go-diff) [![Coverage Status](https://coveralls.io/repos/sergi/go-diff/badge.png?branch=master)](https://coveralls.io/r/sergi/go-diff?branch=master)\n\ngo-diff offers algorithms to perform operations required for synchronizing plain text:\n\n- Compare two texts and return their differences.\n- Perform fuzzy matching of text.\n- Apply patches onto text.\n\n## Installation\n\n```bash\ngo get -u github.com/sergi/go-diff/...\n```\n\n## Usage\n\nThe following example compares two texts and writes out the differences to standard output.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/sergi/go-diff/diffmatchpatch\"\n)\n\nconst (\n\ttext1 = \"Lorem ipsum dolor.\"\n\ttext2 = \"Lorem dolor sit amet.\"\n)\n\nfunc main() {\n\tdmp := diffmatchpatch.New()\n\n\tdiffs := dmp.DiffMain(text1, text2, false)\n\n\tfmt.Println(dmp.DiffPrettyText(diffs))\n}\n```\n\n## Found a bug or are you missing a feature in go-diff?\n\nPlease make sure to have the latest version of go-diff. If the problem still persists go through the [open issues](https://github.com/sergi/go-diff/issues) in the tracker first. If you cannot find your request just open up a [new issue](https://github.com/sergi/go-diff/issues/new).\n\n## How to contribute?\n\nYou want to contribute to go-diff? GREAT! If you are here because of a bug you want to fix or a feature you want to add, you can just read on. Otherwise we have a list of [open issues in the tracker](https://github.com/sergi/go-diff/issues). Just choose something you think you can work on and discuss your plans in the issue by commenting on it.\n\nPlease make sure that every behavioral change is accompanied by test cases. Additionally, every contribution must pass the `lint` and `test` Makefile targets which can be run using the following commands in the repository root directory.\n\n```bash\nmake lint\nmake test\n```\n\nAfter your contribution passes these commands, [create a PR](https://help.github.com/articles/creating-a-pull-request/) and we will review your contribution.\n\n## Origins\n\ngo-diff is a Go language port of Neil Fraser's google-diff-match-patch code. His original code is available at [http://code.google.com/p/google-diff-match-patch/](http://code.google.com/p/google-diff-match-patch/).\n\n## Copyright and License\n\nThe original Google Diff, Match and Patch Library is licensed under the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0). The full terms of that license are included here in the [APACHE-LICENSE-2.0](/APACHE-LICENSE-2.0) file.\n\nDiff, Match and Patch Library\n\n\u003e Written by Neil Fraser\n\u003e Copyright (c) 2006 Google Inc.\n\u003e \u003chttp://code.google.com/p/google-diff-match-patch/\u003e\n\nThis Go version of Diff, Match and Patch Library is licensed under the [MIT License](http://www.opensource.org/licenses/MIT) (a.k.a. the Expat License) which is included here in the [LICENSE](/LICENSE) file.\n\nGo version of Diff, Match and Patch Library\n\n\u003e Copyright (c) 2012-2016 The go-diff authors. All rights reserved.\n\u003e \u003chttps://github.com/sergi/go-diff\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergi%2Fgo-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsergi%2Fgo-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergi%2Fgo-diff/lists"}