From ffc3d945bf1e2e820385dfcdc93ae89ce3ff433c Mon Sep 17 00:00:00 2001 From: Rob Shakir Date: Thu, 12 Dec 2024 10:15:58 -0800 Subject: [PATCH] Add a flag to exclude deprecated warnings from `basic_go`. --- .github/workflows/basic_go.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/basic_go.yml b/.github/workflows/basic_go.yml index 09e5549..d3bfc6e 100644 --- a/.github/workflows/basic_go.yml +++ b/.github/workflows/basic_go.yml @@ -13,6 +13,8 @@ on: default: 'latest' static-analysis-excludes-regex: type: string + static-analysis-excludes-deprecated: + type: boolean # TODO(wenvous): gofmt is harder to work with since it always recursively # formats files instead of restricting itself to just listed packages. # See if there is a way to have the same behaviour without relying on the @@ -187,10 +189,15 @@ jobs: if: ${{ !cancelled() && !inputs.skip-staticcheck }} run: | export STATICCHECK_CACHE="${{ runner.temp }}/staticcheck" + if [ -z "${{ inputs.static-analysis-excludes-deprecated }}"]; then + STATICHECK_ARGS="" + else + STATICCHECK_ARGS="-SA1019" + fi if [ -z "${{ inputs.static-analysis-excludes-regex }}" ]; then echo "Running for all packages" - GOGC=30 staticcheck ./... + GOGC=30 staticcheck ${STATICCHECK_ARGS} ./... else echo "Running for non-excluded packages" - GOGC=30 staticcheck $(go list ./... | grep -E -v ${{ inputs.static-analysis-excludes-regex }}) + GOGC=30 staticcheck ${STATICCHECK_ARGS} $(go list ./... | grep -E -v ${{ inputs.static-analysis-excludes-regex }}) fi