-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
29 lines (22 loc) · 960 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
29
COVERPROFILE ?= coverage.out
GOLANGCI_LINT_VERSION ?= v1.42.1
IMAGE ?= quay.io/netobserv/goflow2-loki
ARTIFACT_VERSION ?= $(shell git describe --long HEAD)
CONTAINER_COMMAND ?= docker
prereqs:
@echo "### Test if prerequisites are met, and installing missing dependencies"
test -f $(go env GOPATH)/bin/golangci-lint || go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}
test -f $(go env GOPATH)/bin/staticcheck || go install honnef.co/go/tools/cmd/staticcheck@latest
lint: prereqs
@echo "### Linting code"
# staticcheck does not work properly when invoked inside golangci-lint
staticcheck -f stylish ./...
golangci-lint run ./...
image:
@echo "### Building container with ${CONTAINER_COMMAND}"
${CONTAINER_COMMAND} build --build-arg VERSION=${ARTIFACT_VERSION} -t ${IMAGE} .
test:
@echo "### Testing"
go test ./... -coverprofile ${COVERPROFILE}
verify: lint test
.PHONY: prereqs lint image lint test verify