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

difflines

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package difflines finds the lines a unified diff shows on its new side: the lines GitHub lets a review comment attach to.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map map[string][][2]int

Map holds, per file, the new-side line ranges covered by the diff's hunks (added and context lines).

func Parse

func Parse(diff string) Map

Parse reads a git unified diff with a/ and b/ prefixes. Deleted files and binary files have no new-side lines. Inside a hunk it counts the lines the header promises, so content lines that look like headers ("+++ x" is an added line starting "++ x") are never taken for one.

func (Map) Has

func (m Map) Has(path string, line int) bool

Has reports whether line of path is on the diff's new side.

Jump to

Keyboard shortcuts

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