-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (36 loc) · 966 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
PROJECT = $(shell basename $(PWD))
GOPATH ?= $(shell go env GOPATH)
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
ORG = github.com/AidanFogarty/newbie
.DEFAULT_GOAL := help
## build: Build the binary.
build:
go build -ldflags="-w -s"
## generate: Generate mock files for tests in the project.
generate:
go generate ./...
## test: Run all the tests in the project
test:
go test ./... -v
## lint: Run linter on all Go files in the project
lint:
golangci-lint run --exclude-use-default=false
## fmt: Formats all Go code in the project
fmt:
go fmt ./...
vet:
go vet ./...
dupl:
dupl -t 100 $(shell find . ! -name '*_test.go' -name '*.go')
## ci: Run linter, formatter and tests
ci: build fmt vet lint dupl test
# Thanks to: https://github.com/azer/go-makefile-example
.PHONY: help
all: help
help: Makefile
@echo
@echo " Choose a command run in "$(PROJECT)":"
@echo
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo