Skip to content

Commit

Permalink
#9 Inited goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
roma-glushko committed Jan 17, 2024
1 parent 5790d32 commit 28e4d93
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
CHECKER_BIN=$(PWD)/tmp/bin
VERSION_PACKAGE := glide/pkg
COMMIT ?= $(shell git describe --dirty --long --always --abbrev=15)
VERSION ?= "latest" # TODO: pull/pass a real version
BUILD_DATE ?= $(shell date +"%Y-%m-%d %H:%M:%S")
VERSION ?= "latest"

LDFLAGS_COMMON := "-s -w -X $(VERSION_PACKAGE).commitSha=$(COMMIT) -X $(VERSION_PACKAGE).version=$(VERSION)"
LDFLAGS_COMMON := "-s -w -X $(VERSION_PACKAGE).commitSha=$(COMMIT) -X $(VERSION_PACKAGE).version=$(VERSION) -X $(VERSION_PACKAGE).buildDate=$(BUILD_DATE)"

.PHONY: help

Expand Down
11 changes: 10 additions & 1 deletion pkg/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,17 @@ var version = "devel"
// and will be populated by the Makefile
var commitSha = "unknown"

// buildDate captures the time when the build happened
var buildDate = "unknown"

var FullVersion string

func init() {
FullVersion = fmt.Sprintf("%s (commit: %s, %s)", version, commitSha, runtime.Version())
FullVersion = fmt.Sprintf(
"%s (commit: %s, runtime: %s, buildDate: %s)",
version,
commitSha,
runtime.Version(),
buildDate,
)
}

0 comments on commit 28e4d93

Please sign in to comment.