golangci-lint 934 B

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env bash
  2. set -e -o pipefail
  3. SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  4. # CI platforms differ, so per-platform GOLANGCI_LINT_OPTS can be set
  5. # from a platform-specific Dockerfile, otherwise let's just set
  6. # (somewhat pessimistic) default of 10 minutes.
  7. : "${GOLANGCI_LINT_OPTS=--timeout=10m}"
  8. [ -n "${TESTDEBUG}" ] && set -x
  9. # TODO find a way to share this code with hack/make.sh
  10. if ${PKG_CONFIG} 'libsystemd >= 209' 2> /dev/null; then
  11. DOCKER_BUILDTAGS+=" journald"
  12. elif ${PKG_CONFIG} 'libsystemd-journal' 2> /dev/null; then
  13. DOCKER_BUILDTAGS+=" journald journald_compat"
  14. fi
  15. echo -e "\n\033[0;36mINFO\033[0m Start validation with golang-ci-lint"
  16. # TODO use --out-format=junit-xml and store artifacts
  17. # shellcheck disable=SC2086
  18. GOGC=75 golangci-lint run \
  19. ${GOLANGCI_LINT_OPTS} \
  20. --print-resources-usage \
  21. --build-tags="${DOCKER_BUILDTAGS}" \
  22. --verbose \
  23. --config "${SCRIPTDIR}/golangci-lint.yml"