-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
43 lines (32 loc) · 883 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
export GO111MODULE=on
BIN := src-fingerprint
GO ?= go
GOFLAGS := -v
EXTRA_GOFLAGS ?=
LDFLAGS := $(LDFLAGS) -X main.version=dev -X main.builtBy=makefile`
SOURCES ?= $(shell find ./* -name "*.go" -type f ! -path "./vendor/*")
.PHONY: default
default: build
.PHONY: clean
clean:
$(GO) clean $(GOFLAGS) -i ./...
rm -rf $(BIN)
.PHONY: lint
lint:
golangci-lint run
.PHONY: fmt
fmt:
go fmt ./...
.PHONY: test
test:
@test -z "$$(gofmt -l $(SOURCES))" || (echo "Files need to be linted. Use make fmt" && false)
GIT_TERMINAL_PROMPT=0 $(GO) test $(GOFLAGS) ./... -coverprofile=.coverage.out
go tool cover -func=.coverage.out
.PHONY: build
build: $(BIN)
# Use this target to test packaging
.PHONY: dist
dist:
goreleaser release --skip-publish --skip-validate --rm-dist
$(BIN): $(SOURCES)
$(GO) build $(GOFLAGS) -ldflags '-s -w $(LDFLAGS)' $(EXTRA_GOFLAGS) -o $@ ./cmd/$(BIN)