forked from kf5i/k3ai-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
28 lines (25 loc) · 778 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
build-cli:
go build -o bin/k3ai-cli
.PHONY: lint
lint: check-format
go get golang.org/x/lint/golint
go vet ./...
golint -set_exit_status=1 ./...
.PHONY: check-format
check-format:
@echo "Running gofmt..."
$(eval unformatted=$(shell find . -name '*.go' | grep -v ./.git | grep -v vendor | xargs gofmt -l))
$(if $(strip $(unformatted)),\
$(error $(\n) Some files are ill formatted! Run: \
$(foreach file,$(unformatted),$(\n) gofmt -w $(file))$(\n)),\
@echo All files are well formatted.\
)
.PHONY: test
test:
go test -coverprofile=coverage.txt -covermode=atomic -race ./...