fix: improve date in `version` command (#16365)

set date in go like a sane person
pull/16374/head
Greg 2019-12-30 17:56:58 -07:00 committed by GitHub
parent e79771fdcc
commit b2531c1f97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -23,9 +23,8 @@ else
VERSION := $(shell git describe --exact-match --tags 2>/dev/null)
endif
COMMIT := $(shell git rev-parse --short HEAD)
DATE := $(shell date --utc +%FT%TZ)
LDFLAGS := $(LDFLAGS) -X main.commit=$(COMMIT) -X main.date=$(DATE)
LDFLAGS := $(LDFLAGS) -X main.commit=$(COMMIT)
ifdef VERSION
LDFLAGS += -X main.version=$(VERSION)
endif

View File

@ -5,6 +5,7 @@ import (
_ "net/http/pprof"
"os"
"strings"
"time"
"github.com/influxdata/influxdb"
"github.com/influxdata/influxdb/cmd/influxd/generate"
@ -20,7 +21,7 @@ import (
var (
version = "dev"
commit = "none"
date = "unknown"
date = fmt.Sprint(time.Now().UTC().Format(time.RFC3339))
)
var rootCmd = &cobra.Command{