Skip to content

Commit

Permalink
Merge pull request #558 from asteris-llc/feature/makefile-rewrite-fixes
Browse files Browse the repository at this point in the history
Minor Fixes After Makefile rewrite
  • Loading branch information
arichardet authored Dec 21, 2016
2 parents dcc88f5 + c9e5cc6 commit d9e02c1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
# this way will be evaluated exactly once, and only if used.
#
# meta information about the project
REPO = $(eval REPO := $(shell go list -f '{{.ImportPath}}' .))$(value REPO)
NAME = $(eval NAME := $(shell basename ${REPO}))$(value NAME)
VERSION = $(eval VERSION := $(shell git describe --dirty))$(value VERSION)
PACKAGE_VERSION = $(eval PACKAGE_VERSION := $(shell git describe))$(value PACKAGE_VERSION)
REPO = $(eval REPO := $$(shell go list -f '{{.ImportPath}}' .))$(value REPO)
NAME = $(eval NAME := $$(shell basename ${REPO}))$(value NAME)
VERSION = $(eval VERSION := $$(shell git describe --dirty))$(value VERSION)
PACKAGE_VERSION = $(eval PACKAGE_VERSION := $$(subst -dirty,,$${VERSION}))$(value PACKAGE_VERSION)

# sources to evaluate
SRCDIRS = $(eval SRCDIRS := $(shell glide novendor --no-subdir | grep -v '^.$$' | sed 's|/$$||g'))$(value SRCDIRS)
SRCFILES = $(eval SRCFILES := main.go $(shell find ${SRCDIRS} -name '*.go'))$(value SRCFILES)
SRCDIRS := $(shell find . -maxdepth 1 -mindepth 1 -type d -not -path './vendor')
SRCFILES := main.go $(shell find ${SRCDIRS} -name '*.go')

# binaries
converge: vendor ${SRCFILES} rpc/pb/root.pb.go rpc/pb/root.pb.gw.go
go build -ldflags="-X ${REPO}/cmd.Version=${PACKAGE}"
go build -ldflags="-X ${REPO}/cmd.Version=${VERSION}"

rpc/pb/root.pb.go: rpc/pb/root.proto
protoc -I rpc/pb \
Expand Down Expand Up @@ -89,7 +89,7 @@ bench:
go test -run '^$$' -bench=${BENCH} -benchmem ${BENCHDIRS}

# linting
LINTDIRS = $(eval LINTDIRS := $(shell find ${SRCDIRS} -type d -not -path './rpc/pb' -not -path './docs*'))$(value LINTDIRS)
LINTDIRS = $(eval LINTDIRS := $$(shell find ${SRCDIRS} -type d -not -path './rpc/pb' -not -path './docs*'))$(value LINTDIRS)
.PHONY: lint
lint:
@echo '=== golint ==='
Expand Down
5 changes: 5 additions & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package cmd
import (
"fmt"

"github.com/Sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand All @@ -34,4 +35,8 @@ var versionCmd = &cobra.Command{

func init() {
RootCmd.AddCommand(versionCmd)

if Version == "" {
logrus.Fatal("version is set to blank")
}
}

0 comments on commit d9e02c1

Please sign in to comment.