2018-06-16 19:22:21 -05:00
|
|
|
OS := $(shell uname -s)
|
2018-07-12 08:27:07 -05:00
|
|
|
TEST_PACKAGES := $(shell go list ./... | grep -v cmd)
|
|
|
|
COVER_PACKAGES := $(shell go list ./... | grep -v cmd | paste -sd "," -)
|
2018-06-16 19:22:21 -05:00
|
|
|
LINTER := $(shell command -v gometalinter 2> /dev/null)
|
|
|
|
|
|
|
|
build:
|
2018-06-22 07:01:36 -05:00
|
|
|
@go build -o ./gaper cmd/gaper/main.go
|
2018-06-16 19:22:21 -05:00
|
|
|
|
|
|
|
## lint: Validate golang code
|
2022-08-08 09:40:24 -05:00
|
|
|
# Install it following this doc https://golangci-lint.run/usage/install/#local-installation,
|
|
|
|
# please use the same version from .github/workflows/workflow.yml.
|
2018-06-16 19:22:21 -05:00
|
|
|
lint:
|
2022-08-08 09:40:24 -05:00
|
|
|
@golangci-lint run
|
2018-06-16 19:22:21 -05:00
|
|
|
|
|
|
|
test:
|
2018-06-22 07:01:36 -05:00
|
|
|
@go test -p=1 -coverpkg $(COVER_PACKAGES) \
|
2018-06-16 19:22:21 -05:00
|
|
|
-covermode=atomic -coverprofile=coverage.out $(TEST_PACKAGES)
|
|
|
|
|
|
|
|
cover: test
|
|
|
|
@go tool cover -html=coverage.out
|
|
|
|
|
|
|
|
fmt:
|
|
|
|
@find . -name '*.go' -not -wholename './vendor/*' | \
|
|
|
|
while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done
|