tools: Index | Files

package myers

import ""

Package myers implements the Myers diff algorithm.


Package Files

diff.go unified.go

func ApplyEdits Uses

func ApplyEdits(a []string, operations []*Op) []string

func SplitLines Uses

func SplitLines(text string) []string

type Hunk Uses

type Hunk struct {
    FromLine int
    ToLine   int
    Lines    []Line

type Line Uses

type Line struct {
    Kind    OpKind
    Content string

type Op Uses

type Op struct {
    Kind    OpKind
    Content []string // content from b
    I1, I2  int      // indices of the line in a
    J1      int      // indices of the line in b, J2 implied by len(Content)

func Operations Uses

func Operations(a, b []string) []*Op

Operations returns the list of operations to convert a into b, consolidating operations for multiple lines and not including equal lines.

type OpKind Uses

type OpKind int
const (
    Delete OpKind = iota

func (OpKind) String Uses

func (k OpKind) String() string

type Unified Uses

type Unified struct {
    From, To string
    Hunks    []*Hunk

func ToUnified Uses

func ToUnified(from, to string, lines []string, ops []*Op) Unified

func (Unified) Format Uses

func (u Unified) Format(f fmt.State, r rune)

Package myers imports 2 packages (graph) and is imported by 1 packages. Updated 2019-09-20. Refresh now. Tools for package owners.