forked from ccjenniferhsu/logstash_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (38 loc) · 1.33 KB
/
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
49
50
51
52
53
all: clean format golint
include Makefile.common
TARGET ?= logstash_exporter
GOLINT := $(FIRST_GOPATH)/bin/golangci-lint
GOLINT_VERSION := v1.18.0
vendor:
@echo ">> installing dependencies on vendor"
GO111MODULE=$(GO111MODULE) $(GO) mod vendor
test:
@echo ">> running tests"
GO111MODULE=$(GO111MODULE) $(GO) test -short $(pkgs)
format:
@echo ">> formatting code"
GO111MODULE=$(GO111MODULE) $(GO) fmt $(pkgs)
golint: golangci-lint
@echo ">> linting code"
GO111MODULE=$(GO111MODULE) $(GOLINT) run
build: promu vendor
@echo ">> building binaries"
GO111MODULE=$(GO111MODULE) $(PROMU) build --prefix $(PREFIX)
crossbuild: promu vendor
@echo ">> cross-building binaries"
GO111MODULE=$(GO111MODULE) $(PROMU) crossbuild
tarball: promu vendor
@echo ">> building release tarball"
GO111MODULE=$(GO111MODULE) $(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
tarballs: promu vendor
@echo ">> building release tarballs"
GO111MODULE=$(GO111MODULE) $(PROMU) crossbuild tarballs $(BIN_DIR)
clean:
@echo ">> Cleaning up"
@find . -type f -name '*~' -exec rm -fv {} \;
@rm -fv $(TARGET)
.PHONY: all clean format golint build test
.PHONY: golangci-lint
golangci-lint: $(GOLINT)
$(GOLINT):
curl --silent --fail --location https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(FIRST_GOPATH)/bin ${GOLINT_VERSION}