-
Notifications
You must be signed in to change notification settings - Fork 68
/
Makefile
51 lines (36 loc) · 877 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
49
50
51
ifndef GOBINARY
GOBINARY:="go"
endif
ifndef GOPATH
GOPATH:=$(shell $(GOBINARY) env GOPATH)
endif
ifndef GOBIN
GOBIN:=$(GOPATH)/bin
endif
ifndef GOARCH
GOARCH:=$(shell $(GOBINARY) env GOARCH)
endif
ifndef GOOS
GOOS:=$(shell $(GOBINARY) env GOOS)
endif
ifndef GOARM
GOARM:=$(shell $(GOBINARY) env GOARM)
endif
ifndef TARGET_FILE
TARGET_FILE:=bin/mqtt2prometheus.$(GOOS)_$(GOARCH)$(GOARM)
endif
all: build
GO111MODULE=on
lint:
golangci-lint run
test:
$(GOBINARY) test ./...
$(GOBINARY) vet ./...
build:
GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBINARY) build -o $(TARGET_FILE) ./cmd
static_build:
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBINARY) build -o $(TARGET_FILE) -a -tags netgo -ldflags '-w -extldflags "-static"' ./cmd
container:
docker build -t mqtt2prometheus:latest .
test_release:
goreleaser --rm-dist --skip-validate --skip-publish