Package to store on-build extra information: version(tag), build hash, build time
Go to file
2022-08-25 13:44:06 +02:00
.gitignore Proper License info + gitignore. 2020-10-04 20:29:53 +02:00
go.mod Migration: From github.com to git.webz.asia 2022-08-25 13:44:06 +02:00
LICENSE Proper License info + gitignore. 2020-10-04 20:29:53 +02:00
README.md Migration: From github.com to git.webz.asia 2022-08-25 13:44:06 +02:00
version.go All initial funcs plus module info. 2020-10-03 17:43:46 +02:00

Release GitHub Maintainability Go Report Card GoDoc GoDoc FOSSA Status time tracker

ldflags package

Package to store on-build extra information: version(tag), build hash, build time

Usage

Add this package as dependency to YOUR package:

go get git.webz.asia/version-go/ldflags 

Then on build of YOUR package just add extra:

go build -ldflags "-X 'git.webz.asia/version-go/ldflags.buildVersion=0.1.0' -X 'git.webz.asia/version-go/ldflags.buildHash=9e7637c' -X 'git.webz.asia/version-go/ldflags.buildTime=Sun Oct  4 20:57:29 CEST 2020'" .

Or do it automatically based on existing git/data:

go build -ldflags "-X 'git.webz.asia/version-go/ldflags.buildVersion=$(git describe --abbrev=0 --tags)' -X 'git.webz.asia/version-go/ldflags.buildHash=$(git rev-parse --short HEAD)' -X 'git.webz.asia/version-go/ldflags.buildTime=$(date)'" .

will store current latest tag, commit hash and build time.

License

FOSSA Status