file

package
v0.0.0-...-2a0a49f Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: BSD-4-Clause Imports: 8 Imported by: 0

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

func New(file string) *File

New creates a new parser.Parser instance using the provided file as version information source.

func TryParse

func TryParse(path string) (*File, error)

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) Equal

func (f *File) Equal(o *File) bool

Equal compares the fields of this instance to the given one

func (*File) ParseVersionInfo

func (f *File) ParseVersionInfo() (*buildinfo.VersionInfo, error)

ParseVersionInfo implements the parser.VersionParser interface

func (*File) String

func (f *File) String() string

String implements the fmt.Stringer interface

Jump to

Keyboard shortcuts

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