godiffpatch

package module
v0.0.0-...-798fd1e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2024 License: BSD-3-Clause Imports: 4 Imported by: 7

README

go-diff-patch

Go CI lsif-go

A fork of Go tools. Go-diff-patch is an utility library that is used to generate git-compatible patches that are appliable to any repository.

Installation

go-diff-patch can be installed using the go get command as shown below:

go get github.com/sourcegraph/go-diff-patch
Usage

The library exports a function GeneratePatch which computes edits between the original and updated file contents and produces a unified diff for them as a string. This patch can then be applied to a valid git repository containing the specified file(s).

An example can be found in the examples/ directory.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneratePatch

func GeneratePatch(filename, originalContent, updatedContent string) string

GeneratePatch generates a unified diff that is git-compatible and highlights the difference between originalContent and updatedContent.

Types

This section is empty.

Directories

Path Synopsis
internal
diff
Package diff supports a pluggable diff algorithm.
Package diff supports a pluggable diff algorithm.
diff/myers
Package myers implements the Myers diff algorithm.
Package myers implements the Myers diff algorithm.
span
Package span contains support for representing with positions and ranges in text files.
Package span contains support for representing with positions and ranges in text files.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL