From dbea75ee7686eddb41ba0947f6004d0df30f7e82 Mon Sep 17 00:00:00 2001 From: Till Date: Thu, 18 May 2023 15:15:57 +0800 Subject: [PATCH] fix(cfsauto): fix build time for -V option Signed-off-by: Till --- autofs/README.md | 8 +++++++- autofs/main.go | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/autofs/README.md b/autofs/README.md index b25209000..3f2d7846e 100644 --- a/autofs/README.md +++ b/autofs/README.md @@ -5,7 +5,7 @@ automount tool for [cubefs](https://github.com/cubefs/cubefs) ## build ```bash -go build -v -ldflags="-X main.buildVersion=1.1" -o /usr/local/bin +go build -v -ldflags="-X main.buildVersion=1.1 -X 'main.buildDate=$(date '+%Y-%m-%d %H:%M:%S')'" -o /usr/local/bin ``` ## quick start @@ -23,6 +23,12 @@ cfsauto cfsauto -V +example: + +```bash +Version: 1.1, BuildDate: 2023-05-18 15:08:00 +``` + ## LDAP automount example diff --git a/autofs/main.go b/autofs/main.go index fcfeb2585..6b4fd594a 100644 --- a/autofs/main.go +++ b/autofs/main.go @@ -5,11 +5,10 @@ import ( "github.com/spf13/cobra" "log" "os" - "time" ) var buildVersion = "DebugVersion" -var buildDate = time.Now().String() +var buildDate = "BuildDate" var logFile *os.File