-
Notifications
You must be signed in to change notification settings - Fork 3
/
linting.mk
30 lines (23 loc) · 880 Bytes
/
linting.mk
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
### linting options below
### lint: for local environment
TMP_DIR = /tmp/ethproxy
LINT_VERSION = 1.37.1
LINT_DIR = $(TMP_DIR)/golangci-lint/$(LINT_VERSION)
LINT_BIN = $(LINT_DIR)/golangci-lint
CMD = golangci-lint run --allow-parallel-runners -c .golangci.yml
LINT_ARCHIVE = golangci-lint-$(LINT_VERSION)-$(OSNAME)-amd64.tar.gz
LINT_ARCHIVE_DEST = $(TMP_DIR)/$(LINT_ARCHIVE)
# Run this on local machine.
# It downloads a version of golangci-lint and execute it locally.
.PHONY: lint
lint: $(LINT_BIN)
$(LINT_DIR)/$(CMD)
# install a local golangci-lint if not found.
$(LINT_BIN):
curl -L --create-dirs \
https://github.com/golangci/golangci-lint/releases/download/v$(LINT_VERSION)/$(LINT_ARCHIVE) \
--output $(LINT_ARCHIVE_DEST)
mkdir -p $(LINT_DIR)/
tar -xf $(LINT_ARCHIVE_DEST) --strip-components=1 -C $(LINT_DIR)/
chmod +x $(LINT_BIN)
rm -f $(LINT_ARCHIVE_DEST)