Skip to content

Commit

Permalink
Merge pull request #3 from fugue/add-version
Browse files Browse the repository at this point in the history
Add version
  • Loading branch information
curtis-fugue authored Sep 17, 2019
2 parents 7625601 + 1068385 commit feb3bd8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@

GO=GO111MODULE=on go
BINARY=fugue
VERSION=$(shell cat VERSION)
SHORT_COMMIT=$(shell git rev-parse HEAD | cut -c 1-8)
LD_FLAGS=-ldflags "-X main.version=$(VERSION) -X main.commit=$(SHORT_COMMIT)"

SWAGGER=swagger.yaml
SWAGGER_URL=https://api.riskmanager.fugue.co/v0/swagger
SOURCES=$(shell find . -name '*.go')
GOPATH?=$(shell go env GOPATH)
UPDATE_ENV_SRC=$(shell find models -name "update_environment_input.go")

$(BINARY): $(SOURCES)
$(GO) build -v -o fugue
$(GO) build $(LD_FLAGS) -v -o fugue

.PHONY: build
build: $(BINARY)
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.3.0
3 changes: 2 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ var rootCmd = &cobra.Command{

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
func Execute(version, commit string) {
rootCmd.Version = fmt.Sprintf("%s-%s", version, commit)
CheckErr(rootCmd.Execute())
}

Expand Down
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ package main

import "github.com/fugue/fugue-client/cmd"

var (
version = "localVersion"
commit = "localCommit"
)

func main() {
cmd.Execute()
cmd.Execute(version, commit)
}

0 comments on commit feb3bd8

Please sign in to comment.