forked from iamseth/azure_sql_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
29 lines (23 loc) · 751 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
VERSION := 0.1.0
LDFLAGS := -X main.Version=$(VERSION)
GOFLAGS := -ldflags "$(LDFLAGS)"
GOOS ?= $(shell uname | tr A-Z a-z)
GOARCH ?= $(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m)))
SUFFIX ?= $(GOOS)-$(GOARCH)
ARCHIVE ?= $(BINARY)-$(VERSION).$(SUFFIX).tar.gz
BINARY := azure_sql_exporter-$(VERSION).$(SUFFIX)
./dist/$(BINARY):
mkdir -p ./dist
go build $(GOFLAGS) -o $@
.PHONY: test
test:
go test -v -race $$(go list ./... | grep -v /vendor/)
.PHONY: clean
clean:
rm -rf ./dist
.PHONY: format
format:
find . -name "*.go" |grep -v vendor | xargs goimports -w
.PHONY: docker
docker:
docker run --rm -v "$$PWD":/go/src/github.com/iamseth/azure_sql_exporter -w /go/src/github.com/iamseth/azure_sql_exporter golang:1.6 bash -c make