changelog – evgenykuznetsov.org/go/changelog Index | Files | Directories

package changelog

import "evgenykuznetsov.org/go/changelog"

Package changelog provides a way to create, parse and convert changelogs. Currently, only parsing Markdown keep-a-changelog style and Debian changelogs is implemented for input, and only Debian changelog for output.

Index

Variables

var (
	ErrNotSemver = fmt.Errorf("not semver") // string is not a valid semver
)

Error codes

Types

type Change

type Change struct {
	Type string // "Added", "Fixed", etc.
	Body string // the actual description
}

Change is one change (usually one line in a changelog)

type Changelog

type Changelog map[Version]Release

Changelog is the complete changelog representation

func ParseDebian

func ParseDebian(r io.Reader) (cl Changelog, err error)

ParseDebian reads a Debian changelog into Changelog

func ParseMd

func ParseMd(r io.Reader) (cl Changelog, err error)

ParseMd reads a markdown file (keep-a-changelog style format) into Changelog

func (Changelog) Debian

func (cl Changelog) Debian(packageName string) (out []byte, err error)

Debian outputs Changelog with debian changelog formatting

type Maintainer

type Maintainer struct {
	Name  string
	Email string
}

Maintainer is the maintainer of the package

type Release

type Release struct {
	Date         time.Time
	Changes      []Change
	Urgency      string     // urgency in Debian terms, "medium" is used if none is provided
	Distribution string     // distribution released to (Debian-specific), "stable" is used if none is provided
	Maintainer   Maintainer // package maintainer
}

Release is a single release. A changelog usually comprises of several releases.

type Version

type Version struct {
	Major      int
	Minor      int
	Patch      int
	Prerelease string
}

Version is a recognized version (following semver conventions)

func ToVersion

func ToVersion(s string) (v Version, err error)

ToVersion converts string to Version (if possible)

func (Version) String

func (v Version) String() string

String implements fmt.Stringer interface for Version

Source Files

changelog.go

Directories

PathSynopsis
cmd
cmd/changelogThe changelog binary generates a Debian changelog from a Markdown keep-a-changelog-style one
Version
v0.0.0-20230315153832-ccd49ca12641 (latest)
Published
Mar 15, 2023
Platform
linux/amd64
Imports
8 packages
Last checked
3 days ago

Tools for package owners.