bash syntax fixes

This commit is contained in:
2026-04-03 15:41:13 -04:00
parent d54c42045a
commit 7c5206e9da
3 changed files with 14 additions and 13 deletions

View File

@@ -2,7 +2,7 @@
set -eo pipefail
if [[ "$STATIC_FLAG" == "no" && "$VULN_CHECK" == "no" ]]; then
if [ "$STATIC_FLAG" == "no" && "$VULN_CHECK" == "no" ]; then
echo "[INFO] no security flags set, skipping!";
exit 0;
fi
@@ -13,15 +13,16 @@ echo "[DEBUG] $toolchain found in go.mod";
version=$(go env -json | jq -r ".GOVERSION");
echo "[DEBUG] $version found in go env";
if [[ ! -z "$toolchain" ]]; then
if [ ! -z "$toolchain" ]; then
echo "[DEBUG] overwriting version with toolchain";
version=$toolchain;
fi
if [[ "$STATIC_FLAG" == "yes" ]]; then
if [ "$STATIC_FLAG" == "yes" ]; then
if GOTOOLCHAIN=$version gosec ./...; then
echo "[INFO] gosec passed!";
else
if [[ "$STATIC_FAIL" == "yes" ]]; then
if [ "$STATIC_FAIL" == "yes" ]; then
echo "[FATAL] gosec failed!";
exit 1;
else
@@ -30,11 +31,11 @@ if [[ "$STATIC_FLAG" == "yes" ]]; then
fi
fi
if [[ "$VULN_CHECK" == "yes" ]]; then
if [ "$VULN_CHECK" == "yes" ]; then
if GOTOOLCHAIN=$version govulncheck ./...; then
echo "[INFO] govulncheck passed!";
else
if [[ "$VULN_FAIL" == "yes" ]]; then
if [ "$VULN_FAIL" == "yes" ]; then
echo "[FATAL] govulncheck failed!"
exit 1;
else