Skip to content

Commit 7308438

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
hack: add --gitlint to install-tools.sh
Unlike the other tools gitlint is python, but that's not much of a stretch to install it like the other Go based tools. The naming is now a bit wrong, but that's a problem that can be fixed later. Signed-off-by: John Mulligan <[email protected]>
1 parent f9b9853 commit 7308438

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

hack/install-tools.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#
77
set -e
88
GO_CMD=${GO_CMD:-$(command -v go)}
9+
PY_CMD="${PY_CMD:-$(command -v python3)}"
910
GOBIN=${GOBIN:-${GOPATH}/bin}
1011

1112
_require_gobin() {
@@ -40,6 +41,13 @@ _install_gosec() {
4041
_install_tool github.com/securego/gosec/v2/cmd/[email protected]
4142
}
4243

44+
_install_gitlint() {
45+
_require_gobin
46+
"${PY_CMD}" -m venv "${GOBIN}/.py"
47+
"${GOBIN}/.py/bin/pip" install "gitlint==0.19.1"
48+
ln -s "${GOBIN}/.py/bin/gitlint" "${GOBIN}/gitlint"
49+
}
50+
4351
case "$1" in
4452
--kustomize)
4553
_require_gobin
@@ -65,15 +73,19 @@ case "$1" in
6573
_require_gobin
6674
_install_gosec
6775
;;
76+
--gitlint)
77+
_install_gitlint
78+
;;
6879
*)
6980
echo "usage: GOBIN=<dir> $0 --<tool-name>"
7081
echo ""
71-
echo "availabel tools:"
82+
echo "available tools:"
7283
echo " --kustomize"
7384
echo " --controller-gen"
7485
echo " --revive"
7586
echo " --golangci-lint"
7687
echo " --yq"
7788
echo " --gosec"
89+
echo " --gitlint"
7890
;;
7991
esac

0 commit comments

Comments
 (0)