version

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	Version   = "dev"     // Version number
	GitCommit = "unknown" // Git commit hash
	BuildDate = "unknown" // Build date
	GoVersion = runtime.Version()
)

These variables are set at build time using ldflags

Functions

This section is empty.

Types

type Info

type Info struct {
	Version   string `json:"version"`
	GitCommit string `json:"git_commit"`
	BuildDate string `json:"build_date"`
	GoVersion string `json:"go_version"`
	Arch      string `json:"arch"`
	OS        string `json:"os"`
}

Info contains version information

func Get

func Get() Info

Get returns version information

func (Info) Detailed

func (i Info) Detailed() string

Detailed returns detailed version information

Example
info := Info{
	Version:   "1.0.0",
	GitCommit: "abc123",
	BuildDate: "2024-01-15",
	GoVersion: "go1.21.0",
	OS:        "darwin",
	Arch:      "arm64",
}
fmt.Println(info.Detailed())
Output:

devx version information:
  Version:    1.0.0
  Git commit: abc123
  Build date: 2024-01-15
  Go version: go1.21.0
  OS/Arch:    darwin/arm64

func (Info) String

func (i Info) String() string

String returns a formatted version string

Example
info := Info{
	Version:   "1.0.0",
	GitCommit: "abc123def",
	BuildDate: "2024-01-15",
}
fmt.Println(info.String())
Output:

devx version 1.0.0 (abc123d) built 2024-01-15

Jump to

Keyboard shortcuts

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