From 98a0a13210b5fb827731ef4d20b1eca0ba2a281a Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 5 Oct 2020 20:23:48 +0200 Subject: [PATCH] Fix build vars in doc. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5160d9a..e5dd789 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,11 @@ go get github.com/version-go/ldflags Then on build of YOUR package just add extra: ```bash -go build -ldflags "-X 'github.com/version-go/ldflags.version=0.1.0' -X 'github.com/version-go/ldflags.hash=9e7637c' -X 'github.com/version-go/ldflags.time=Sun Oct 4 20:57:29 CEST 2020'" . +go build -ldflags "-X 'github.com/version-go/ldflags.buildVersion=0.1.0' -X 'github.com/version-go/ldflags.buildHash=9e7637c' -X 'github.com/version-go/ldflags.buildTime=Sun Oct 4 20:57:29 CEST 2020'" . ``` Or do it automatically based on existing git/data: ```bash -go build -ldflags "-X 'github.com/version-go/ldflags.version=$(git describe --abbrev=0 --tags)' -X 'github.com/version-go/ldflags.hash=$(git rev-parse --short HEAD)' -X 'github.com/version-go/ldflags.time=$(date)'" . +go build -ldflags "-X 'github.com/version-go/ldflags.buildVersion=$(git describe --abbrev=0 --tags)' -X 'github.com/version-go/ldflags.buildHash=$(git rev-parse --short HEAD)' -X 'github.com/version-go/ldflags.buildTime=$(date)'" . ``` will store current latest tag, commit hash and build time.