Skip to content

Commit

Permalink
Propagate version and buildtime to cli
Browse files Browse the repository at this point in the history
instead of setting it from there...
  • Loading branch information
robertgzr committed Oct 14, 2019
1 parent 243b748 commit 4c3c293
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
3 changes: 2 additions & 1 deletion cmd/a2o-migrate/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
PWD := $(shell pwd)
VERSION ?= $(shell git describe --tag --always)

GO_BUILDINFO=-X main.GitVersion=$(VERSION) -X main.BuildTime=$(shell date -u +%Y-%m-%dT%H:%M:%SZ)
PROJECT=github.com/docker/docker/cmd/a2o-migrate
GO_BUILDINFO=-X $(PROJECT).gitVersion=$(VERSION) -X $(PROJECT).buildTime=$(shell date -u +%Y-%m-%dT%H:%M:%SZ)
GO_LDFLAGS=-extldflags "-fno-PIC -static"
GO_BUILDFLAGS=-ldflags '$(GO_LDFLAGS) $(GO_BUILDINFO)' -tags 'osusergo netgo static_build'

Expand Down
6 changes: 3 additions & 3 deletions cmd/a2o-migrate/a2o-migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
)

var ( // auto generated on build
GitVersion = "undefined"
BuildTime = "undefined"
gitVersion = "undefined"
buildTime = "undefined"
)

var ( // flag values
Expand Down Expand Up @@ -53,7 +53,7 @@ func Main() {

switch {
case printVersion:
fmt.Fprintf(os.Stdout, "a2o-migrate version %s (build %s)\n", GitVersion, BuildTime)
fmt.Fprintf(os.Stdout, "a2o-migrate version %s (build %s)\n", gitVersion, buildTime)
os.Exit(0)

case runMigration:
Expand Down
7 changes: 0 additions & 7 deletions cmd/a2o-migrate/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ import (
"github.com/docker/docker/cmd/a2o-migrate"
)

var ( // auto generated on build
GitVersion = "undefined"
BuildTime = "undefined"
)

func main() {
a2omigrate.GitVersion = GitVersion
a2omigrate.BuildTime = BuildTime
a2omigrate.Main()
}

0 comments on commit 4c3c293

Please sign in to comment.