Skip to content

Commit

Permalink
Update Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Clivern committed Jun 13, 2019
1 parent b940c15 commit 4804eb3
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Makefile
Expand Up @@ -5,21 +5,21 @@ pkgs = ./...

help: Makefile
@echo
@echo " Choose a command run in Beaver:"
@echo " Choose a command run in Hippo:"
@echo
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo


## install_revive: Install revive for linting.
install_revive:
@echo ">> Install revive"
@echo ">> ============= Install Revive ============= <<"
$(GO) get github.com/mgechev/revive


## style: Check code style.
style:
@echo ">> checking code style"
@echo ">> ============= Checking Code Style ============= <<"
@fmtRes=$$($(GOFMT) -d $$(find . -path ./vendor -prune -o -name '*.go' -print)); \
if [ -n "$${fmtRes}" ]; then \
echo "gofmt checking failed!"; echo "$${fmtRes}"; echo; \
Expand All @@ -30,7 +30,7 @@ style:

## check_license: Check if license header on all files.
check_license:
@echo ">> checking license header"
@echo ">> ============= Checking License Header ============= <<"
@licRes=$$(for file in $$(find . -type f -iname '*.go' ! -path './vendor/*') ; do \
awk 'NR<=3' $$file | grep -Eq "(Copyright|generated|GENERATED)" || echo $$file; \
done); \
Expand All @@ -42,36 +42,37 @@ check_license:

## test_short: Run test cases with short flag.
test_short:
@echo ">> running short tests"
@echo ">> ============= Running Short Tests ============= <<"
$(GO) test -short $(pkgs)


## test: Run test cases.
test:
@echo ">> running all tests"
@echo ">> ============= Running All Tests ============= <<"
$(GO) test -race -cover $(pkgs)


## lint: Lint the code.
lint:
@echo ">> Lint all files"
@echo ">> ============= Lint All Files ============= <<"
revive -config config.toml -exclude vendor/... -formatter friendly ./...


## format: Format the code.
format:
@echo ">> formatting code"
@echo ">> ============= Formatting Code ============= <<"
$(GO) fmt $(pkgs)


## vet: Examines source code and reports suspicious constructs.
vet:
@echo ">> vetting code"
@echo ">> ============= Vetting Code ============= <<"
$(GO) vet $(pkgs)


## coverage: Create HTML coverage report
coverage:
@echo ">> ============= Coverage ============= <<"
rm -f coverage.html cover.out
$(GO) test -coverprofile=cover.out $(pkgs)
go tool cover -html=cover.out -o coverage.html
Expand Down

0 comments on commit 4804eb3

Please sign in to comment.