Skip to content

Commit

Permalink
Bump version to 1.3.2 and move Version to a build time variable
Browse files Browse the repository at this point in the history
  • Loading branch information
bwhaley committed Jul 16, 2019
1 parent 3df956e commit 891b539
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)

.PHONY: build test golint docs $(PROJECT) $(PKGS) vendor

VERSION := $(shell echo ${SSMSH_VERSION})
ifeq "$(VERSION)" ""
$(error must define SSMSH_VERSION env var)
endif


GOVERSION := $(shell go version | grep 1.12)
ifeq "$(GOVERSION)" ""
$(error must be running Go version 1.12.x)
Expand All @@ -26,7 +32,7 @@ DEP := $(GOPATH)/bin/dep
$(DEP):
go get -u github.com/golang/dep

GO_LDFLAGS := -X $(shell go list ./$(PACKAGE)).GitCommit=$(GIT_COMMIT)
GO_LDFLAGS := -X $(shell go list ./$(PACKAGE)).GitCommit=$(GIT_COMMIT) -X main.Version=${VERSION}

test: $(PKGS)

Expand All @@ -46,9 +52,9 @@ vendor: $(DEP)
build:
go build -i -ldflags "$(GO_LDFLAGS)" -o $(GOPATH)/bin/$(EXECUTABLE) $(PROJECT)
build-linux:
GOOS=linux GOARCH=amd64 go build -o $(GOPATH)/bin/$(EXECUTABLE)-linux-amd64
GOOS=linux GOARCH=amd64 go build -ldflags "$(GO_LDFLAGS)" -o $(GOPATH)/bin/$(EXECUTABLE)-linux-amd64
build-darwin:
GOOS=darwin GOARCH=amd64 go build -o $(GOPATH)/bin/$(EXECUTABLE)-darwin-amd64
GOOS=darwin GOARCH=amd64 go build -ldflags "$(GO_LDFLAGS)" -o $(GOPATH)/bin/$(EXECUTABLE)-darwin-amd64

clean:
rm -f $(GOPATH)/bin/$(EXECUTABLE) $(GOPATH)/bin/$(EXECUTABLE)-*
10 changes: 5 additions & 5 deletions ssmsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ import (
"github.com/mattn/go-shellwords"
)

const version = "1.3.1"
var Version string

func main() {
var _version bool
var version bool
_fn := flag.String("file", "", "Read commands from file (use - for stdin)")
flag.BoolVar(&_version, "version", false, "Display the current version")
flag.BoolVar(&version, "version", false, "Display the current version")
flag.Parse()

if _version {
fmt.Println("Version", version)
if version {
fmt.Println("Version", Version)
os.Exit(0)
}

Expand Down

0 comments on commit 891b539

Please sign in to comment.