linemerge

package
v0.45.2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package linemerge merges two edits of one text file, made from a common base, by lines. The result depends only on the three inputs.

Index

Constants

View Source
const (
	// MaxBytes is the most bytes that Merge takes from each input.
	MaxBytes = 1 << 20
	// MaxLines is the most lines that Merge takes from each input.
	MaxLines = 20000
)

Variables

View Source
var (
	// ErrBinary is an input that holds a NUL byte.
	ErrBinary = errors.New("linemerge: an input is binary")
	// ErrTooLarge is an input that passes MaxBytes or MaxLines.
	ErrTooLarge = errors.New("linemerge: an input is too large")
	// ErrOverlap is two sides that change the same lines or lines that touch.
	ErrOverlap = errors.New("linemerge: both sides change the same lines")
	// ErrTooManyEdits is a side that differs from the base by more than the bound of the diff.
	ErrTooManyEdits = errors.New("linemerge: a side differs from the base by too many lines")
)

Functions

func Merge

func Merge(base, ours, theirs []byte) ([]byte, error)

Merge returns the base with the edits of both sides. It returns ErrTooLarge, ErrBinary, ErrOverlap or ErrTooManyEdits when it cannot merge them. Two sides that make the same change merge.

Types

This section is empty.

Jump to

Keyboard shortcuts

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