Skip to content

Commit

Permalink
build(versions): Fix version linking
Browse files Browse the repository at this point in the history
  • Loading branch information
elldritch committed Jan 31, 2018
1 parent 20b2d6b commit 605a9c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ endif
.PHONY: default

default:
GOBIN=${GOBIN} go install -ldflags '-X main.revision=$(shell git rev-parse HEAD)' github.com/fossas/fossa-cli/cmd/fossa
GOBIN=${GOBIN} go install -ldflags '-X main.version=$(shell git rev-parse --abbrev-ref HEAD) -X main.commit=$(shell git rev-parse HEAD)' github.com/fossas/fossa-cli/cmd/fossa

clean:
rm -f $(GOPATH)/bin/fossa
9 changes: 5 additions & 4 deletions cmd/fossa/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ type cliContext struct {
config Config
}

// main.version is picked up by goreleaser
var version = "0.2.4"
var revision string
// main.{version,revision} are set by linker flags in Makefile and goreleaser
var version string
var commit string

var context = cliContext{}

func main() {
app := cli.NewApp()
app.Name = "fossa-cli"
app.Usage = "get dependencies from your code"
app.Version = version + " (rev " + revision + ")"
app.Version = version + " (revision " + commit + ")"
app.Action = DefaultCmd
app.Flags = []cli.Flag{
cli.StringFlag{Name: "config, c", Usage: "path to config file; defaults to .fossa.yml or .fossa.yaml"},
Expand Down

0 comments on commit 605a9c0

Please sign in to comment.