Skip to content

Commit

Permalink
Replace which with command -v
Browse files Browse the repository at this point in the history
command -v is POSIX shell and doesn't require an additional binary
  • Loading branch information
mrueg committed Aug 29, 2023
1 parent ffbdb6f commit d4e4499
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ endif
@echo
@benchstat $(OUTPUT_DIR)/bench_storage.old.txt $(OUTPUT_DIR)/bench_storage.txt

HAS_BENCHSTAT:=$(shell which benchstat)
HAS_BENCHSTAT:=$(shell command -v benchstat)
.PHONY: benchstat
benchstat:
ifndef HAS_BENCHSTAT
Expand Down Expand Up @@ -221,7 +221,7 @@ update: update-licenses update-lint update-toc update-deps update-generated
# License
# -------

HAS_ADDLICENSE:=$(shell which addlicense)
HAS_ADDLICENSE:=$(shell command -v addlicense)
.PHONY: verify-licenses
verify-licenses:addlicense
find -type f -name "*.go" ! -path "*/vendor/*" | xargs $(GOPATH)/bin/addlicense -check || (echo 'Run "make update"' && exit 1)
Expand Down Expand Up @@ -267,7 +267,7 @@ verify-toc: mdtoc $(docs_with_toc)
update-toc: mdtoc $(docs_with_toc)
$(GOPATH)/bin/mdtoc --inplace $(docs_with_toc)

HAS_MDTOC:=$(shell which mdtoc)
HAS_MDTOC:=$(shell command -v mdtoc)
.PHONY: mdtoc
mdtoc:
ifndef HAS_MDTOC
Expand All @@ -281,7 +281,7 @@ endif
verify-structured-logging: logcheck
$(GOPATH)/bin/logcheck ./... || (echo 'Fix structured logging' && exit 1)

HAS_LOGCHECK:=$(shell which logcheck)
HAS_LOGCHECK:=$(shell command -v logcheck)
.PHONY: logcheck
logcheck:
ifndef HAS_LOGCHECK
Expand Down
8 changes: 4 additions & 4 deletions test/test-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ delete_cluster() {
}

setup_helm() {
HELM=$(which helm || true)
HELM=$(command -v helm || true)
if [[ ${HELM} == "" || $(${HELM} |grep Version |awk -F'Version:' '{print $2}' |awk -F',' '{print $1}') != "\"v${HELM_VERSION}\"" ]] ; then
HELM=_output/helm
fi
Expand All @@ -30,7 +30,7 @@ setup_helm() {
}

setup_kind() {
KIND=$(which kind || true)
KIND=$(command -v kind || true)
if [[ ${KIND} == "" || $(${KIND} --version) != "kind version ${KIND_VERSION}" ]] ; then
KIND=_output/kind
fi
Expand All @@ -44,7 +44,7 @@ setup_kind() {
}

setup_skaffold() {
SKAFFOLD=$(which skaffold || true)
SKAFFOLD=$(command -v skaffold || true)
if [[ ${SKAFFOLD} == "" || $(${SKAFFOLD} version) != "v${SKAFFOLD_VERSION}" ]] ; then
SKAFFOLD=_output/skaffold
fi
Expand All @@ -62,7 +62,7 @@ get_kubectl_version() {
}

setup_kubectl() {
KUBECTL=$(which kubectl || true)
KUBECTL=$(command -v kubectl || true)
if [[ ${KUBECTL} == "" || $(get_kubectl_version) != "v${KUBECTL_VERSION}" ]] ; then
KUBECTL=_output/kubectl
fi
Expand Down

0 comments on commit d4e4499

Please sign in to comment.