git

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package git provides git operations for tags and repository state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTag

func CreateTag(dir string, module string, version string) error

CreateTag creates a git tag for a module version. For submodules, uses format "module/version". For root, uses format "version".

func CreateTags

func CreateTags(dir string, tags []Tag) error

CreateTags creates multiple git tags atomically.

func FormatTag

func FormatTag(module string, version string) string

FormatTag creates a tag name from module and version. For root module (empty module name), returns just the version. For submodules, returns "module/version".

func GetAllTags

func GetAllTags(dir string) (map[string][]string, error)

GetAllTags returns all tags grouped by module. Returns a map of module short name -> list of versions.

func GetChangedFiles

func GetChangedFiles(dir string, sinceRef string) ([]string, error)

GetChangedFiles returns files changed since a given ref (branch/tag).

func GetLatestVersions

func GetLatestVersions(dir string) (map[string]string, error)

GetLatestVersions returns the latest version for each module. Returns a map of module short name -> version (e.g., "xkafka" -> "v0.10.0"). Root module uses empty string as key.

func HasUncommittedChanges

func HasUncommittedChanges(dir string) (bool, error)

HasUncommittedChanges returns true if there are uncommitted changes.

func ParseTag

func ParseTag(tagName string) (module string, version string, ok bool)

ParseTag parses a git tag name into module and version. Examples:

"v0.10.0"                    -> ("", "v0.10.0", true)
"xkafka/v0.10.0"             -> ("xkafka", "v0.10.0", true)
"xkafka/middleware/v0.10.0"  -> ("xkafka/middleware", "v0.10.0", true)
"not-a-version"              -> ("", "", false)

func PushTags

func PushTags(dir string, tags []Tag, remote string) error

PushTags pushes tags to the remote.

Types

type Tag

type Tag struct {
	Name    string // Full tag name (e.g., "xkafka/v0.10.0")
	Module  string // Module short name (e.g., "xkafka", or "" for root)
	Version string // Semantic version (e.g., "v0.10.0")
}

Tag represents a parsed git tag.

func GetTags

func GetTags(dir string) ([]Tag, error)

GetTags returns all version tags in the repository.

Jump to

Keyboard shortcuts

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