Skip to content

Commit

Permalink
Add a Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
kaustubhkurve committed Aug 6, 2020
1 parent c913ef6 commit 82519f3
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 0 deletions.
55 changes: 55 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
all: clean check-quality build test golangci

ALL_PACKAGES=$(shell go list ./...)
SOURCE_DIRS=$(shell go list ./... | cut -d "/" -f2 | uniq)

clean:
rm -rf ./out
GO111MODULE=on go mod tidy -v

check-quality: setup lint fmt imports vet

setup:
GO111MODULE=off go get -v golang.org/x/tools/cmd/goimports
GO111MODULE=off go get -v golang.org/x/lint/golint

lint:
@if [[ `golint $(ALL_PACKAGES) | { grep -vwE "exported (var|function|method|type|const) \S+ should have comment" || true; } | wc -l | tr -d ' '` -ne 0 ]]; then \
golint $(ALL_PACKAGES) | { grep -vwE "exported (var|function|method|type|const) \S+ should have comment" || true; }; \
exit 2; \
fi;

fmt:
gofmt -l -s -w $(SOURCE_DIRS)

imports:
./scripts/lint.sh check_imports

vet:
go vet ./...

cyclo:
gocyclo -over 6 $(SOURCE_DIRS)


fix_imports:
goimports -l -w .

golangci:
GO111MODULE=off go get -v github.com/golangci/golangci-lint/cmd/golangci-lint
golangci-lint run -v --deadline 5m0s


build:
@echo "Building './out/albatross'"
@mkdir -p ./out
@go build -o out/albatross ./cmd/service

test:
go test -race ./...

testcodecov:
go test -race -coverprofile=coverage.txt -covermode=atomic ./...

run: build
./out/albatross
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ require (
go.uber.org/zap v1.10.0
gotest.tools v2.2.0+incompatible
helm.sh/helm/v3 v3.2.4
rsc.io/letsencrypt v0.0.3 // indirect
)
Loading

0 comments on commit 82519f3

Please sign in to comment.