-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
33 lines (24 loc) · 821 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
VERSION = 1.0
COMMIT = $(shell git describe --always)
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
default: build
deps:
go mod vendor
# build generate binary on './bin' directory.
build: deps
go build -ldflags "-X main.Version=$(VERSION) -w -s" -o bin/prometheus-nacos-sd .
buildx: deps
GOGS=linux GOARCH=amd64 go build -ldflags "-X main.Version=$(VERSION) -w -s" -o "bin/prometheus-nacos-sd_linux_amd64_v$(VERSION)" .
upx bin/prometheus-nacos-sd_linux_amd64_v$(VERSION) || true
lint:
golint ${GOFILES_NOVENDOR}
vet:
go vet -v ${GOFILES_NOVENDOR}
test:
go test -v ${GOFILES_NOVENDOR}
fmt:
gofmt -l -w ${GOFILES_NOVENDOR}
release: buildx
git tag v$(VERSION)
git push origin v$(VERSION)
ghr -u afghanistanyn v$(VERSION) bin/prometheus-nacos-sd_linux_amd64_v$(VERSION)