version

package
v0.0.0-...-d92a64e Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2013 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

helpers to get the version information for a checked out library

Index

Constants

This section is empty.

Variables

View Source
var VCSDirs = map[string]VcsFn{
	".git": GitHead,
	".bzr": BzrRevno,
	".hg":  HgTip,
}

map of Version control directory names, and the func to call on a path of that type, in order to get a version.

Functions

func BzrRevno

func BzrRevno(pth string) (num string)

functionally equivalent to `bzr revno`

func GitHead

func GitHead(pth string) (hash string)

functionally equivalent to `git rev-parse --short HEAD`

func HgTip

func HgTip(pth string) (tip string)

functionally equivalent to `hg log -l1 --template "{rev}.{node|short}\n"`

Types

type VcsFn

type VcsFn func(string) string

Version control versioner

Takes an argument of the path to check, and returns a string of the version

type Version

type Version struct {
	Path  string // path of the import that this Version is for
	Value string // Manually setting a version string
}

func FromDir

func FromDir(pth, root string) Version

Check for VCS in pth file path, not to exceed root.

func FromPackage

func FromPackage(pkg *build.Package) Version

Given a build.Package, check the Dir for a directory matching CVSDirRe, if nothing check parents until SrcRoot

func (Version) String

func (v Version) String() string

Stringer formating of a Version, regardless of which VCS or an explicit Value

Jump to

Keyboard shortcuts

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