version

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: Apache-2.0, BSD-3-Clause, MIT Imports: 3 Imported by: 0

Documentation

Overview

Package version provides build info and version strings Per AI.md PART 7: Common Go Modules - version/version.go

Index

Constants

View Source
const BrowserUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0"

BrowserUserAgent is the standard User-Agent string for browser-like HTTP requests. Windows 11 Edge - consistent across all engines for privacy and compatibility.

Variables

View Source
var (
	// Version is the semantic version (e.g., "1.0.0")
	Version = "dev"

	// Commit is the git commit hash
	Commit = "unknown"

	// BuildDate is the build timestamp
	BuildDate = "unknown"

	// Branch is the git branch name
	Branch = "unknown"

	// GoVersion is set at build time
	GoVersion = runtime.Version()
)

Build-time variables - set via ldflags

Functions

func GetCommitShort

func GetCommitShort() string

GetCommitShort returns the first 7 characters of the commit hash

func GetShort

func GetShort() string

GetShort returns just the version string

func IsDev

func IsDev() bool

IsDev returns true if this is a development build

Types

type Info

type Info struct {
	Version   string `json:"version"`
	Commit    string `json:"commit"`
	BuildDate string `json:"build_date"`
	Branch    string `json:"branch"`
	GoVersion string `json:"go_version"`
	OS        string `json:"os"`
	Arch      string `json:"arch"`
	Compiler  string `json:"compiler"`
}

Info contains all version information

func Get

func Get() Info

Get returns the current version info

func (Info) Full

func (i Info) Full() string

Full returns a detailed version string

func (Info) Short

func (i Info) Short() string

Short returns just the version number

func (Info) String

func (i Info) String() string

String returns a formatted version string

func (Info) UserAgent

func (i Info) UserAgent(binaryName string) string

UserAgent returns a User-Agent string for HTTP clients

Jump to

Keyboard shortcuts

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