-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (31 loc) · 809 Bytes
/
Makefile
File metadata and controls
40 lines (31 loc) · 809 Bytes
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
30
31
32
33
34
35
36
37
38
39
40
SHELL=/bin/bash
PROJECT_NAME =$(notdir $(shell pwd))
LINTER := $(shell command -v ./build/golangci-lint 2> /dev/null)
COVERAGE_PROFILE ?= coverage.out
default: build
.PHONY: build
build:
@echo "---> Building"
go build -race -o ./build/$(PROJECT_NAME)
.PHONY: lint
lint:
@echo "---> Linting"
ifndef LINTER
@curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build v1.54.2
endif
@./build/golangci-lint run
.PHONY: run
run:
@go run *.go
.PHONY: test
test:
@echo "---> Testing"
@ENVIRONMENT=test go test -p 1 ./... -coverprofile $(COVERAGE_PROFILE)
.PHONY: html
html: test
@echo "---> Generating HTML coverage report"
@go tool cover -html $(COVERAGE_PROFILE) -o ./build/coverage.html
.PHONY: clean
clean:
@echo "---> Cleaning"
rm -rf ./build