Skip to content

Commit cc3b58a

Browse files
committed
Hoist the LINT_OS case lowering out from just for shellcheck
I know YAGNI, but this seems like a good idea to have as common code. I also changed the name so it matches LINT_OS for grouping. Signed-off-by: Manuel Mendez <[email protected]>
1 parent 82a3692 commit cc3b58a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ GOLINT_VERSION ?= v1.42.1
66
HADOLINT_VERSION ?= v2.7.0
77
SHELLCHECK_VERSION ?= v0.7.2
88
YAMLLINT_VERSION ?= 1.26.3
9-
LINT_OS := $(shell uname)
109
LINT_ARCH := $(shell uname -m)
10+
LINT_OS := $(shell uname)
11+
LINT_OS_LOWER := $(shell echo $(LINT_OS) | tr '[:upper:]' '[:lower:]')
1112
LINT_ROOT := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
1213

1314
# shellcheck and hadolint lack arm64 native binaries: rely on x86-64 emulation
@@ -17,7 +18,6 @@ ifeq ($(LINT_OS),Darwin)
1718
endif
1819
endif
1920

20-
LINT_LOWER_OS = $(shell echo $(LINT_OS) | tr '[:upper:]' '[:lower:]')
2121
GOLINT_CONFIG = $(LINT_ROOT)/.golangci.yml
2222
YAMLLINT_ROOT = out/linters/yamllint-$(YAMLLINT_VERSION)
2323

@@ -36,7 +36,7 @@ fix: out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck out/li
3636
out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck:
3737
mkdir -p out/linters
3838
rm -rf out/linters/shellcheck-*
39-
curl -sSfL https://github.com/koalaman/shellcheck/releases/download/$(SHELLCHECK_VERSION)/shellcheck-$(SHELLCHECK_VERSION).$(LINT_LOWER_OS).$(LINT_ARCH).tar.xz | tar -C out/linters -xJf -
39+
curl -sSfL https://github.com/koalaman/shellcheck/releases/download/$(SHELLCHECK_VERSION)/shellcheck-$(SHELLCHECK_VERSION).$(LINT_OS_LOWER).$(LINT_ARCH).tar.xz | tar -C out/linters -xJf -
4040
mv out/linters/shellcheck-$(SHELLCHECK_VERSION) out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)
4141

4242
out/linters/hadolint-$(HADOLINT_VERSION)-$(LINT_ARCH):

Makefile.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
{{ if .Dockerfile}}HADOLINT_VERSION ?= v2.7.0{{ end }}
77
{{ if .Shell}}SHELLCHECK_VERSION ?= v0.7.2{{ end }}
88
{{ if .YAML}}YAMLLINT_VERSION ?= 1.26.3{{ end }}
9-
LINT_OS := $(shell uname)
109
LINT_ARCH := $(shell uname -m)
10+
LINT_OS := $(shell uname)
11+
LINT_OS_LOWER := $(shell echo $(LINT_OS) | tr '[:upper:]' '[:lower:]')
1112
LINT_ROOT := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
1213

1314
# shellcheck and hadolint lack arm64 native binaries: rely on x86-64 emulation
@@ -17,7 +18,6 @@ ifeq ($(LINT_OS),Darwin)
1718
endif
1819
endif
1920

20-
{{ if .Shell }}LINT_LOWER_OS = $(shell echo $(LINT_OS) | tr '[:upper:]' '[:lower:]'){{ end }}
2121
{{ if .Go }}GOLINT_CONFIG = $(LINT_ROOT)/.golangci.yml{{ end }}
2222
{{ if .YAML }}YAMLLINT_ROOT = out/linters/yamllint-$(YAMLLINT_VERSION){{ end }}
2323

@@ -35,7 +35,7 @@ fix: {{ if .Shell }}out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/sh
3535
out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck:
3636
mkdir -p out/linters
3737
rm -rf out/linters/shellcheck-*
38-
curl -sSfL https://github.com/koalaman/shellcheck/releases/download/$(SHELLCHECK_VERSION)/shellcheck-$(SHELLCHECK_VERSION).$(LINT_LOWER_OS).$(LINT_ARCH).tar.xz | tar -C out/linters -xJf -
38+
curl -sSfL https://github.com/koalaman/shellcheck/releases/download/$(SHELLCHECK_VERSION)/shellcheck-$(SHELLCHECK_VERSION).$(LINT_OS_LOWER).$(LINT_ARCH).tar.xz | tar -C out/linters -xJf -
3939
mv out/linters/shellcheck-$(SHELLCHECK_VERSION) out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)
4040

4141
{{ end -}}

0 commit comments

Comments
 (0)