Help us shape the future of Go! Take the 2026 Go Developer Survey

patch

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package patch provides functionality for generating patches from selections.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(
	parsed *diff.ParsedDiff, selections []*diff.FileSelection,
) ([]byte, error)

Generate creates a patch containing only the selected lines. The patch can be applied with `git apply --cached`.

func GenerateForFile

func GenerateForFile(file *diff.FileDiff) []byte

GenerateForFile creates a patch for a single file with all its changes.

func GenerateForHunk

func GenerateForHunk(file *diff.FileDiff, hunk *diff.Hunk) []byte

GenerateForHunk creates a patch for a single hunk.

Types

This section is empty.

Jump to

Keyboard shortcuts

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