commit

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 2 Imported by: ? 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 commit provides core interfaces for parsed conventional commits. Consumers depend on these interfaces independently of the backing parser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiagnosticPosition

func DiagnosticPosition(msg string, err error) (line, column int, ok bool)

DiagnosticPosition returns the 1-based line and column for err in msg when err carries a byte offset, or false otherwise.

func FirstLine

func FirstLine(msg string) string

FirstLine returns the first line of msg without its LF or CRLF ending.

func ForEachLine

func ForEachLine(s string, fn func(line string) bool)

ForEachLine iterates over lines in s without their LF or CRLF endings. Iteration stops if fn returns false.

Types

type Commit

type Commit interface {
	Message() string
	Header() string
	Body() string
	Footer() string
	Type() string
	Scope() string
	Description() string
	Notes() []Note
	IsBreakingChange() bool

	HasHeaderBang() bool
	HasBreakingFooter() bool
	BodyBlankLines() int
	FooterBlankLines() int
	NoteCount() int
	NoteAt(index int) Note
}

Commit represents a parsed conventional commit message.

func Inspect

func Inspect(input string) (Commit, []error)

Inspect exposes recoverable fields alongside all syntax diagnostics. A nil commit means structural recovery was unsafe.

type Note

type Note interface {
	Token() string
	Value() string
}

Note represents a footer note.

type Parser

type Parser interface {
	Parse(msg string) (Commit, error)
}

Parser parses a commit message into a Commit.

func NewParser

func NewParser() Parser

NewParser returns a stateless parser backed by syntax.

Jump to

Keyboard shortcuts

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