version

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package version provides version information for the application. It is designed to be populated at build time using ldflags.

Example usage:

go build -ldflags "-X github.com/goformx/goforms/internal/infrastructure/version.Version=1.0.0"

Index

Constants

View Source
const (
	// UnknownVersion represents an unknown version value
	UnknownVersion = "unknown"
)

Variables

View Source
var (
	// Version is the semantic version of the application
	Version = UnknownVersion
	// BuildTime is the time when the application was built
	BuildTime = UnknownVersion
	// GitCommit is the git commit hash of the build
	GitCommit = UnknownVersion
	// GoVersion is the version of Go used to build the application
	GoVersion = UnknownVersion
)

Functions

This section is empty.

Types

type Info

type Info struct {
	Version   string `json:"version"`
	BuildTime string `json:"buildTime"`
	GitCommit string `json:"gitCommit"`
	GoVersion string `json:"goVersion"`
}

Info contains version information

func GetInfo

func GetInfo() Info

GetInfo returns the version information as an Info struct

func (Info) Compare added in v0.1.5

func (i Info) Compare(other Info) int

Compare compares this version with another version Returns:

-1 if this version is less than the other version
 0 if this version is equal to the other version
 1 if this version is greater than the other version

func (Info) GetBuildTime added in v0.1.5

func (i Info) GetBuildTime() (time.Time, error)

GetBuildTime returns the build time as a time.Time

func (Info) IsDev added in v0.1.5

func (i Info) IsDev() bool

IsDev returns true if the version is a development version

func (Info) IsPreRelease added in v0.1.5

func (i Info) IsPreRelease() bool

IsPreRelease returns true if the version is a pre-release version

func (Info) IsRelease added in v0.1.5

func (i Info) IsRelease() bool

IsRelease returns true if the version is a release version

func (Info) String added in v0.1.5

func (i Info) String() string

String returns a string representation of the version information

func (Info) Validate added in v0.1.5

func (i Info) Validate() error

Validate checks if the version information is valid

Jump to

Keyboard shortcuts

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