Skip to content

Commit

Permalink
Add semantic version to the version command
Browse files Browse the repository at this point in the history
  • Loading branch information
dherbst committed Jan 3, 2021
1 parent 0f9a343 commit 3db8c1d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
8 changes: 6 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ import (
"time"
)

// GitHash is the sha hash of the current commit used to build this code.
var GitHash string
var (
// GitHash is the sha hash of the current commit used to build this code.
GitHash string
// Version is the semantic version according to the release.
Version string
)

// Client is used to make calls to the septa website.
type Client struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/septa/septa.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func init() {

// Version prints the version from the septa.GitHash out and exits.
func Version(ctx context.Context) {
fmt.Printf("Version: %v\n", septa.GitHash)
fmt.Printf("Version: %v %v\n", septa.Version, septa.GitHash)
}

// Usage prints how to invoke `septa` from the command line.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ require (
github.com/securego/gosec v0.0.0-20200401082031-e946c8c39989 // indirect
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 // indirect
golang.org/x/mod v0.4.0 // indirect
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e // indirect
golang.org/x/tools v0.0.0-20210102185154-773b96fafca2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ golang.org/x/tools v0.0.0-20201223200349-f6952e403d3f h1:bQhvijM1G4xRg8EoTAIvy+e
golang.org/x/tools v0.0.0-20201223200349-f6952e403d3f/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e h1:4nW4NLDYnU28ojHaHO8OVxFHk/aQ33U01a9cjED+pzE=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210102185154-773b96fafca2 h1:crjwvdT+rSAILpNOKhk/BNmefsucqGTeeRX2YBK/6Jg=
golang.org/x/tools v0.0.0-20210102185154-773b96fafca2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
3 changes: 2 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
GOLANG := golang:1.15
GOOS := darwin

VERSION := 1.1.1
GIT_HASH = $(shell git rev-parse --short HEAD)
LDFLAGS := "-X github.com/dherbst/septa.GitHash=${GIT_HASH}"
LDFLAGS := "-X github.com/dherbst/septa.GitHash=${GIT_HASH} -X github.com/dherbst/septa.Version=${VERSION}"

all: clean pull lint sec test build install

Expand Down

0 comments on commit 3db8c1d

Please sign in to comment.