Skip to content

Commit cb49176

Browse files
committed
Use full paths for executables and their grand-parent dirs
This is required for golangci-lint when multiple modules are found but good practice anyway, thus why I'm adding to all the linters. Signed-off-by: Manuel Mendez <[email protected]>
1 parent 2fdfa62 commit cb49176

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Makefile.tmpl

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ FIXERS :=
2222

2323
{{ if .Shell -}}
2424
SHELLCHECK_VERSION ?= v0.8.0
25-
SHELLCHECK_BIN := out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)
25+
SHELLCHECK_BIN := $(LINT_ROOT)/out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)
2626
$(SHELLCHECK_BIN):
27-
mkdir -p out/linters
27+
mkdir -p $(LINT_ROOT)/out/linters
2828
curl -sSfL -o [email protected] https://github.com/koalaman/shellcheck/releases/download/$(SHELLCHECK_VERSION)/shellcheck-$(SHELLCHECK_VERSION).$(LINT_OS_LOWER).$(LINT_ARCH).tar.xz \
2929
|| echo "Unable to fetch shellcheck for $(LINT_OS)/$(LINT_ARCH): falling back to locally install"
3030
31-
&& tar -C out/linters -xJf [email protected] \
32-
&& mv out/linters/shellcheck-$(SHELLCHECK_VERSION)/shellcheck $@ \
31+
&& tar -C $(LINT_ROOT)/out/linters -xJf [email protected] \
32+
&& mv $(LINT_ROOT)/out/linters/shellcheck-$(SHELLCHECK_VERSION)/shellcheck $@ \
3333
|| printf "#!/usr/bin/env shellcheck\n" > $@
3434
chmod u+x $@
3535

@@ -45,9 +45,9 @@ shellcheck-fix: $(SHELLCHECK_BIN)
4545

4646
{{ if .Dockerfile -}}
4747
HADOLINT_VERSION ?= v2.8.0
48-
HADOLINT_BIN := out/linters/hadolint-$(HADOLINT_VERSION)-$(LINT_ARCH)
48+
HADOLINT_BIN := $(LINT_ROOT)/out/linters/hadolint-$(HADOLINT_VERSION)-$(LINT_ARCH)
4949
$(HADOLINT_BIN):
50-
mkdir -p out/linters
50+
mkdir -p $(LINT_ROOT)/out/linters
5151
curl -sSfL -o [email protected] https://github.com/hadolint/hadolint/releases/download/$(HADOLINT_VERSION)/hadolint-$(LINT_OS)-$(LINT_ARCH) \
5252
|| echo "Unable to fetch hadolint for $(LINT_OS)/$(LINT_ARCH), falling back to local install"
5353
test -f [email protected] && mv $(HADOLINT_BIN).dl $@ || printf "#!/usr/bin/env hadolint\n" > $@
@@ -62,12 +62,12 @@ hadolint-lint: $(HADOLINT_BIN)
6262
{{ if .Go -}}
6363
GOLANGCI_LINT_CONFIG := $(LINT_ROOT)/.golangci.yml
6464
GOLANGCI_LINT_VERSION ?= v1.43.0
65-
GOLANGCI_LINT_BIN := out/linters/golangci-lint-$(GOLANGCI_LINT_VERSION)-$(LINT_ARCH)
65+
GOLANGCI_LINT_BIN := $(LINT_ROOT)/out/linters/golangci-lint-$(GOLANGCI_LINT_VERSION)-$(LINT_ARCH)
6666
$(GOLANGCI_LINT_BIN):
67-
mkdir -p out/linters
68-
rm -rf out/linters/golangci-lint-*
69-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b out/linters $(GOLANGCI_LINT_VERSION)
70-
mv out/linters/golangci-lint $@
67+
mkdir -p $(LINT_ROOT)/out/linters
68+
rm -rf $(LINT_ROOT)/out/linters/golangci-lint-*
69+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(LINT_ROOT)/out/linters $(GOLANGCI_LINT_VERSION)
70+
mv $(LINT_ROOT)/out/linters/golangci-lint $@
7171

7272
LINTERS += golangci-lint-lint
7373
golangci-lint-lint: $(GOLANGCI_LINT_BIN)
@@ -81,12 +81,12 @@ golangci-lint-fix: $(GOLANGCI_LINT_BIN)
8181

8282
{{ if .YAML -}}
8383
YAMLLINT_VERSION ?= 1.26.3
84-
YAMLLINT_ROOT := out/linters/yamllint-$(YAMLLINT_VERSION)
84+
YAMLLINT_ROOT := $(LINT_ROOT)/out/linters/yamllint-$(YAMLLINT_VERSION)
8585
YAMLLINT_BIN := $(YAMLLINT_ROOT)/dist/bin/yamllint
8686
$(YAMLLINT_BIN):
87-
mkdir -p out/linters
88-
rm -rf out/linters/yamllint-*
89-
curl -sSfL https://github.com/adrienverge/yamllint/archive/refs/tags/v$(YAMLLINT_VERSION).tar.gz | tar -C out/linters -zxf -
87+
mkdir -p $(LINT_ROOT)/out/linters
88+
rm -rf $(LINT_ROOT)/out/linters/yamllint-*
89+
curl -sSfL https://github.com/adrienverge/yamllint/archive/refs/tags/v$(YAMLLINT_VERSION).tar.gz | tar -C $(LINT_ROOT)/out/linters -zxf -
9090
cd $(YAMLLINT_ROOT) && pip3 install --target dist . || pip install --target dist .
9191

9292
LINTERS += yamllint-lint

0 commit comments

Comments
 (0)