gitver

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTemplate = "{{if .Dirty}}dirty-{{.User}}-{{end}}{{.Commits}}.{{.Hash}}"

DefaultTemplate Default template for formatting GitVersion using String()

Variables

This section is empty.

Functions

func GitBranch

func GitBranch() (string, error)

GitBranch gets the current git branch

func GitProjectPaths

func GitProjectPaths(projects []string) ([]string, error)

GitProjectPaths gives absolute paths given project paths relative to the git root

func GitRootPath

func GitRootPath() (string, error)

GitRootPath retrieves the absolute path of the root of this versioned git tree

func SetWorkingDir

func SetWorkingDir(dir string)

SetWorkingDir sets the working directory for running git commands

Types

type GitVersion

type GitVersion struct {
	Branch  string
	Commits string
	Hash    string
	Dirty   bool
	User    string
}

GitVersion version information about one or more git projects

func New

func New(paths []string) (*GitVersion, error)

New creates a new GitVersion for the specified paths

func (*GitVersion) FormatTemplate

func (ver *GitVersion) FormatTemplate(templateString string) (string, error)

FormatTemplate formats a GitVersion using a text/template string

func (*GitVersion) String

func (ver *GitVersion) String() string

Jump to

Keyboard shortcuts

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