From c8aaeea285c63f9add09e01bd8260d1bce61a97d Mon Sep 17 00:00:00 2001 From: Austin Vazquez Date: Mon, 22 Dec 2025 16:18:43 -0600 Subject: [PATCH] ci: run golangci-lint for each Go module Signed-off-by: Austin Vazquez --- hack/validate/golangci-lint | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/hack/validate/golangci-lint b/hack/validate/golangci-lint index 0eb4919ab8..06459d9729 100755 --- a/hack/validate/golangci-lint +++ b/hack/validate/golangci-lint @@ -15,13 +15,19 @@ if pkg-config 'libsystemd' 2> /dev/null; then DOCKER_BUILDTAGS+=" journald" fi -echo -e "\n\033[0;36mINFO\033[0m Start validation with golang-ci-lint" +# Note: exclude github.com/docker/docker/man as it contains no Go code. +mods=($(find . -name "go.mod" -type f -exec dirname {} \; | grep -v "man" | sort -u)) +for mod in "${mods[@]}"; do + pushd "${mod}" > /dev/null + echo -e "\n\033[0;36mINFO\033[0m Start validation for module '${mod}' with golang-ci-lint" -# TODO use --out-format=junit-xml and store artifacts -# shellcheck disable=SC2086 -GOGC=75 golangci-lint run \ - ${GOLANGCI_LINT_OPTS} \ - --print-resources-usage \ - --build-tags="${DOCKER_BUILDTAGS}" \ - --verbose \ - --config "${REPODIR}/.golangci.yml" + # TODO use --out-format=junit-xml and store artifacts + # shellcheck disable=SC2086 + GOGC=75 golangci-lint run \ + ${GOLANGCI_LINT_OPTS} \ + --print-resources-usage \ + --build-tags="${DOCKER_BUILDTAGS}" \ + --verbose \ + --config "${REPODIR}/.golangci.yml" + popd > /dev/null +done