-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (33 loc) · 1.23 KB
/
Makefile
File metadata and controls
47 lines (33 loc) · 1.23 KB
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
41
42
43
44
45
46
47
project?=github.com/mprimi/go-bench-away
projectname?=go-bench-away
version?=dev
sha?=$(shell git rev-parse --short HEAD)
date?=$(shell date "+%Y-%m-%d_%H:%M:%S")
default: build
.PHONY: build install run test clean cover vet fmt lint mod update-deps check
build:
@go build -ldflags "-X $(project)/v1/core.Version=$(version) -X $(project)/v1/core.SHA=$(sha) -X $(project)/v1/core.BuildDate=$(date)" -o $(projectname)
install:
@go install -ldflags "-X $(project)/v1/core.Version=$(version) -X $(project)/v1/core.SHA=$(sha) -X $(project)/v1/core.BuildDate=$(date)"
run:
@go run main.go -ldflags "-X $(project)/v1/core.Version=$(version) -X $(project)/v1/core.SHA=$(sha) -X $(project)/v1/core.BuildDate=$(date)" main.go
test:
@go test -v -failfast -count=1 ./...
clean:
@rm -rf coverage.out dist/ $(projectname)
cover:
@go test -race $(shell go list ./... | grep -v /vendor/) -v -coverprofile=coverage.out
@go tool cover -func=coverage.out
@go tool cover -html coverage.out -o coverage.html
vet:
@go vet ./...
fmt:
@gofmt -w -s .
lint: # Depends on https://github.com/golangci/golangci-lint
@golangci-lint run -c .golangci-lint.yml --fix
mod:
@go mod tidy
update-deps:
@go get -u -t ./...
@go mod tidy
check: mod fmt test lint cover vet