-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
62 lines (47 loc) · 1.6 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
54
55
56
57
58
59
60
61
62
VERSION := $(shell git describe --abbrev=0 --tags)
DOCKER_IMAGE = banzaicloud/logging-operator
DOCKER_TAG ?= ${VERSION}
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./client/*")
PKGS=$(shell go list ./... | grep -v /vendor)
DEP_VERSION = 0.5.0
bin/dep: bin/dep-${DEP_VERSION}
@ln -sf dep-${DEP_VERSION} bin/dep
bin/dep-${DEP_VERSION}:
@mkdir -p bin
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | INSTALL_DIRECTORY=bin DEP_RELEASE_TAG=v${DEP_VERSION} sh
@mv bin/dep $@
.PHONY: vendor
vendor: bin/dep ## Install dependencies
bin/dep ensure -v -vendor-only
build: vendor
go build -v $(PKGS)
check-fmt:
PKGS="${GOFILES_NOVENDOR}" GOFMT="gofmt" ./scripts/fmt-check.sh
fmt:
gofmt -w ${GOFILES_NOVENDOR}
lint: install-golint
golint -min_confidence 0.9 -set_exit_status $(PKGS)
install-golint:
GOLINT_CMD=$(shell command -v golint 2> /dev/null)
ifndef GOLINT_CMD
go get golang.org/x/lint/golint
endif
check-misspell: install-misspell
PKGS="${GOFILES_NOVENDOR}" MISSPELL="misspell" ./scripts/misspell-check.sh
misspell: install-misspell
misspell -w ${GOFILES_NOVENDOR}
install-misspell:
MISSPELL_CMD=$(shell command -v misspell 2> /dev/null)
ifndef MISSPELL_CMD
go get -u github.com/client9/misspell/cmd/misspell
endif
ineffassign: install-ineffassign
ineffassign ${GOFILES_NOVENDOR}
install-ineffassign:
INEFFASSIGN_CMD=$(shell command -v ineffassign 2> /dev/null)
ifndef INEFFASSIGN_CMD
go get -u github.com/gordonklaus/ineffassign
endif
.PHONY: docker
docker: ## Build Docker image
docker build -t ${DOCKER_IMAGE}:${DOCKER_TAG} -f Dockerfile .