Documentation ¶
Index ¶
Constants ¶
View Source
const ( Filename = "VERSION" AltFilename = "VERSION.txt" )
Variables ¶
View Source
var ( // Error when trying to parse a directory that does not contain a version file ErrNoFile = fs.ErrNotExist // ErrMalformedVersion is the error used when parsing invalid version information. ErrMalformedVersion = errors.New("malformed version information") // ErrMalformedRevision is the error used when parsing invalid revision information. ErrMalformedRevision = errors.New("malformed revision information") // ErrMalformedBranch is the error used when parsing invalid branch information. ErrMalformedBranch = errors.New("malformed branch information") )
Functions ¶
func ParseVersionInfo ¶
func ParseVersionInfo(info []byte) (*buildinfo.VersionInfo, error)
ParseVersionInfo extract version information from the provided input. it generally can been seen as the inverse of VersionInfo.VersionRevision()
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
parser.VersionParser implementation reading information from a file
func New ¶
New creates a new parser.Parser instance using the provided file as version information source.
func TryParse ¶
TryParse attempts to parse the version information from various files in the given directory. If no files known to contain version information exist, ErrNoRepository is returned. All other errors are a result of file access problems or data corruption issues.
func (*File) ParseVersionInfo ¶
func (f *File) ParseVersionInfo() (*buildinfo.VersionInfo, error)
ParseVersionInfo implements the parser.VersionParser interface
Click to show internal directories.
Click to hide internal directories.