Skip to content

Commit

Permalink
Add a flag to exclude deprecated warnings from basic_go.
Browse files Browse the repository at this point in the history
  • Loading branch information
robshakir committed Dec 12, 2024
1 parent 6b5a0ac commit ffc3d94
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/basic_go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit ffc3d94

Please sign in to comment.