version

package
v0.0.0-...-a1c22f6 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: MIT Imports: 1 Imported by: 0

README

AKS versioning

Standardized version string package for AKS.

Set the semver in the makefile for the service.

Add the following to the Makefile for the service and add -ldflags $(LD_FLAGS) to the go build call in the Makefile:

VERSION         ?= 1.0.0
GIT_HASH        ?= $(shell git rev-parse --short HEAD)
BUILD_TIME      ?= $(shell date -u '+%Y-%m-%d_%I:%M:%S%p')
LD_FLAGS        ?= -X goms.io/aks/rp/core/version.Version=$(VERSION) -X goms.io/aks/rp/core/version.GitHash=$(GIT_HASH) -X goms.io/aks/rp/core/version.BuildTime=$(BUILD_TIME)

To use this in a CLI application call version.String() inside any string printer.

To use this in a JSON logging service call version.Print(<your_logger_here>).

Documentation

Overview

Package version contains code to return the running version

Index

Constants

This section is empty.

Variables

View Source
var (
	Version   = "unset"
	GitBranch = "unset"
	GitHash   = "unset"
	BuildTime = "unset"
)

Version ... These variables are populated at build time in the Makefile

Functions

func ShortString

func ShortString() string

ShortString wil return the version info as a short string instead of a sugared logger. In format of "{Version} {GitHash} {GitBranch} ({BuildTime})"

func String

func String() string

String will return the version info as a raw string instead of a sugared logger. Use this in cases where you are not using JSON log formats (like a user-facing CLI tool).

Types

This section is empty.

Jump to

Keyboard shortcuts

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