mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-11 00:44:20 -05:00
c1f9d86cd3
* explicitly ignore pkgs for cleaner output * do not ignore but redirect stderr * silent env var to silent stderr * add silent env var to vuln,lint,tf * fix golangci silent * Update bazel/ci/terraform.sh.in Co-authored-by: Malte Poll <1780588+malt3@users.noreply.github.com> * Update bazel/ci/golicenses.sh.in Co-authored-by: Malte Poll <1780588+malt3@users.noreply.github.com> * Update bazel/ci/govulncheck.sh.in Co-authored-by: Malte Poll <1780588+malt3@users.noreply.github.com> * Update bazel/ci/golangci_lint.sh.in Co-authored-by: Malte Poll <1780588+malt3@users.noreply.github.com> --------- Co-authored-by: Malte Poll <1780588+malt3@users.noreply.github.com>
58 lines
1.3 KiB
Bash
58 lines
1.3 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
###### script header ######
|
|
|
|
lib=$(realpath @@BASE_LIB@@) || exit 1
|
|
stat "${lib}" >> /dev/null || exit 1
|
|
|
|
# shellcheck source=../sh/lib.bash
|
|
if ! source "${lib}"; then
|
|
echo "Error: could not find import"
|
|
exit 1
|
|
fi
|
|
|
|
golangcilint=$(realpath @@GOLANGCI-LINT@@)
|
|
stat "${golangcilint}" >> /dev/null
|
|
go=$(realpath @@GO@@)
|
|
stat "${go}" >> /dev/null
|
|
|
|
cd "${BUILD_WORKSPACE_DIRECTORY}"
|
|
|
|
###### script body ######
|
|
|
|
readarray -t <<< "$(${go} list -f '{{.Dir}}' -m)"
|
|
modules=("${MAPFILE[@]}")
|
|
|
|
excludeMods=(
|
|
"hack/tools"
|
|
)
|
|
|
|
check() {
|
|
echo "The following Go modules are excluded and won't be linted with golangci-lint:"
|
|
for exclude in "${excludeMods[@]}"; do
|
|
for i in "${!modules[@]}"; do
|
|
if [[ ${modules[i]} == "${BUILD_WORKSPACE_DIRECTORY}/${exclude}" ]]; then
|
|
echo " ${modules[i]}"
|
|
unset 'modules[i]'
|
|
fi
|
|
done
|
|
done
|
|
|
|
statuscode=0
|
|
|
|
echo "Linting the following Go modules with golangci-lint:"
|
|
for mod in "${modules[@]}"; do
|
|
echo " ${mod}"
|
|
PATH="$(dirname "${go}"):${PATH}" GOROOT=$(${go} env GOROOT) GOPATH=$(${go} env GOPATH) GOCACHE=$(${go} env GOCACHE) CGO_ENABLED=0 ${golangcilint} run --timeout=15m "${mod}/..." >&2
|
|
statuscode=$?
|
|
done
|
|
|
|
exit "${statuscode}"
|
|
}
|
|
|
|
if test -v SILENT; then
|
|
check > /dev/null
|
|
else
|
|
check
|
|
fi
|