forked from chef/automate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.common_go
38 lines (28 loc) · 1.31 KB
/
Makefile.common_go
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
# Note: this looks weird -- it's because this Makefile is to be included from
# components/xyz-service/Makefile
REPOROOT?=../..
LIBRARY_PATH = github.com/chef/automate/lib
UNAME_S:=$(shell uname -s)
ifeq ($(UNAME_S),Linux)
PLATFORM:=linux-amd64
endif
ifeq ($(UNAME_S),Darwin)
PLATFORM:=darwin-amd64
endif
GOLANGCILINTVERSION?=1.16.0
GOLANGCILINTTARBALL:=golangci-lint-$(GOLANGCILINTVERSION)-$(PLATFORM).tar.gz
LINTERARGS?=./...
$(REPOROOT)/cache/$(GOLANGCILINTTARBALL):
curl --output $(REPOROOT)/cache/$(GOLANGCILINTTARBALL) -L https://github.com/golangci/golangci-lint/releases/download/v$(GOLANGCILINTVERSION)/$(GOLANGCILINTTARBALL)
$(REPOROOT)/cache/golangci-lint-$(GOLANGCILINTVERSION)-$(PLATFORM)/golangci-lint: $(REPOROOT)/cache/$(GOLANGCILINTTARBALL)
tar zxf $(REPOROOT)/cache/$(GOLANGCILINTTARBALL) -C $(REPOROOT)/cache/
touch $(REPOROOT)/cache/golangci-lint-$(GOLANGCILINTVERSION)-$(PLATFORM)/golangci-lint
lint: $(REPOROOT)/cache/golangci-lint-$(GOLANGCILINTVERSION)-$(PLATFORM)/golangci-lint
$(REPOROOT)/cache/golangci-lint-$(GOLANGCILINTVERSION)-$(PLATFORM)/golangci-lint run -c $(REPOROOT)/.golangci.toml $(LINTERARGS)
golang_version_check:
@$(REPOROOT)/scripts/golang_version_check.sh
fmt:
@gofmt -w -l ./
fmt-check:
@test -z $(shell gofmt -l ./cmd/ ./pkg/)
.PHONY: lint fmt fmt-check golang_version_check