2019-08-05 06:32:43 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e -o pipefail
|
|
|
|
|
2020-03-02 22:27:49 -05:00
|
|
|
SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
2019-08-05 06:32:43 -04:00
|
|
|
|
|
|
|
# CI platforms differ, so per-platform GOLANGCI_LINT_OPTS can be set
|
|
|
|
# from a platform-specific Dockerfile, otherwise let's just set
|
|
|
|
# (somewhat pessimistic) default of 10 minutes.
|
2019-09-19 11:59:26 -04:00
|
|
|
: "${GOLANGCI_LINT_OPTS=--timeout=10m}"
|
2019-08-05 06:32:43 -04:00
|
|
|
|
|
|
|
[ -n "${TESTDEBUG}" ] && set -x
|
|
|
|
|
2019-08-06 20:12:46 -04:00
|
|
|
# TODO find a way to share this code with hack/make.sh
|
2020-03-02 22:27:49 -05:00
|
|
|
if ${PKG_CONFIG} 'libsystemd >= 209' 2> /dev/null; then
|
2019-08-06 20:12:46 -04:00
|
|
|
DOCKER_BUILDTAGS+=" journald"
|
2020-03-02 22:27:49 -05:00
|
|
|
elif ${PKG_CONFIG} 'libsystemd-journal' 2> /dev/null; then
|
2019-08-06 20:12:46 -04:00
|
|
|
DOCKER_BUILDTAGS+=" journald journald_compat"
|
|
|
|
fi
|
|
|
|
|
2019-10-11 07:31:18 -04:00
|
|
|
echo -e "\n\033[0;36mINFO\033[0m Start validation with golang-ci-lint"
|
|
|
|
|
2019-08-05 06:32:43 -04:00
|
|
|
# TODO use --out-format=junit-xml and store artifacts
|
2019-09-19 11:59:26 -04:00
|
|
|
# shellcheck disable=SC2086
|
|
|
|
GOGC=75 golangci-lint run \
|
2019-08-05 06:32:43 -04:00
|
|
|
${GOLANGCI_LINT_OPTS} \
|
|
|
|
--print-resources-usage \
|
|
|
|
--build-tags="${DOCKER_BUILDTAGS}" \
|
|
|
|
--verbose \
|
2019-09-19 11:59:26 -04:00
|
|
|
--config "${SCRIPTDIR}/golangci-lint.yml"
|