-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c913ef6
commit 82519f3
Showing
4 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.