From ea97e299822545f046fd0bbf46db846b8a1cb154 Mon Sep 17 00:00:00 2001 From: Eyal Kapon Date: Sat, 22 Nov 2025 19:29:04 +0200 Subject: [PATCH 1/2] Add staticcheck-checks input to golangci-lint action - Add staticcheck-checks input to allow custom staticcheck configuration - Default to 'all' to maintain backward compatibility - This allows users to disable specific checks like QF1008 --- actions/golangci-lint/action.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/actions/golangci-lint/action.yml b/actions/golangci-lint/action.yml index def6487..7e7cab2 100644 --- a/actions/golangci-lint/action.yml +++ b/actions/golangci-lint/action.yml @@ -1,6 +1,12 @@ name: 'GolangCi Static Code Analysis' description: 'GolangCi Static Code Analysis' +inputs: + staticcheck-checks: + description: 'Staticcheck checks configuration' + required: false + default: 'all' + runs: using: 'composite' steps: @@ -13,4 +19,4 @@ runs: with: skip-cache: true args: | - --timeout 5m --enable errcheck,ineffassign,staticcheck,unused,gocritic,asasalint,asciicheck,errchkjson,forcetypeassert,makezero,nilerr,unparam,unconvert,wastedassign,usestdlibvars --disable govet + --timeout 5m --enable errcheck,ineffassign,staticcheck,unused,gocritic,asasalint,asciicheck,errchkjson,forcetypeassert,makezero,nilerr,unparam,unconvert,wastedassign,usestdlibvars --disable govet --staticcheck.checks="${{ inputs.staticcheck-checks }}" From 3a37e3b4bc5639889980e60f6528e2cff32a4236 Mon Sep 17 00:00:00 2001 From: Eyal Kapon Date: Mon, 24 Nov 2025 11:21:33 +0200 Subject: [PATCH 2/2] Fix staticcheck-checks to use config file instead of CLI flag - golangci-lint does not support --staticcheck.checks as a CLI flag - Create temporary .golangci.yml if it doesn't exist - Use input parameter to configure staticcheck checks in the config file --- actions/golangci-lint/action.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/actions/golangci-lint/action.yml b/actions/golangci-lint/action.yml index 7e7cab2..bb9e59e 100644 --- a/actions/golangci-lint/action.yml +++ b/actions/golangci-lint/action.yml @@ -14,9 +14,21 @@ runs: shell: bash run: go mod download + - name: Configure staticcheck + shell: bash + run: | + if [ ! -f .golangci.yml ]; then + cat > .golangci.yml << 'EOF' + linters-settings: + staticcheck: + checks: + - "${{ inputs.staticcheck-checks }}" + EOF + fi + - name: Static Code Analysis uses: golangci/golangci-lint-action@v8 with: skip-cache: true args: | - --timeout 5m --enable errcheck,ineffassign,staticcheck,unused,gocritic,asasalint,asciicheck,errchkjson,forcetypeassert,makezero,nilerr,unparam,unconvert,wastedassign,usestdlibvars --disable govet --staticcheck.checks="${{ inputs.staticcheck-checks }}" + --timeout 5m --enable errcheck,ineffassign,staticcheck,unused,gocritic,asasalint,asciicheck,errchkjson,forcetypeassert,makezero,nilerr,unparam,unconvert,wastedassign,usestdlibvars --disable govet