Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/cgo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,45 @@ jobs:
- name: Run custom linters
run: make golint-custom LINTER_FLAGS="-errstringmatch -panicinlibrarycode -manualmutexunlock -osexitinlibrary -rawloginlib -logfatallibrary -regexpcompileinfunction -fprintlnsprintf -strconvparseignorederror -jsonmarshalignoredeerror -uncheckedtypeassertion -fmterrorfnoverbs -tolowerequalfold -httpnoctx -timeafterleak -errortypeassertion -execcommandwithoutcontext -sprintfint -stringsindexcontains -stringscountcontains -bytesbufferstring -ioutildeprecated -mapclearloop -mapdeletecheck -sprintfbool -appendoneelement -timenowsub -stringsjoinone -writebytestring -lenstringsplit -stringreplaceminusone -osgetenvlibrary -ossetenvlibrary -stringsindexhasprefix -contextcancelnotdeferred -ctxbackground -wgdonenotdeferred -goroutinemissingrecover -trimleftright -walkfuncerrshadow -uncheckedflushreturn -bytescomparestring -nilctxpassed -stringbytesroundtrip -fileclosenotdeferred -timesleepnocontext -sprintferrorsnew -globwalkignorederror -appendbytestring -sortslice -deferinloop -regexpdynamicpattern -test=false"

- name: Determine errormessage lint scope
id: errormessage-scope
env:
EVENT_NAME: ${{ github.event_name }}
BASE_REF: origin/${{ github.base_ref }}
BEFORE_SHA: ${{ github.event.before }}
run: |
set -euo pipefail
files=""
if [ "$EVENT_NAME" = "pull_request" ]; then
if git rev-parse --verify "$BASE_REF" >/dev/null 2>&1; then
files=$(git diff --name-only "$BASE_REF...HEAD" -- '*.go' | tr '\n' ',' | sed 's/,$//')
else
echo "Base ref $BASE_REF not found, falling back to all Go files"
files=$(git ls-files '*.go' | tr '\n' ',' | sed 's/,$//')
fi
elif [ "$EVENT_NAME" = "push" ] && [ -n "$BEFORE_SHA" ] && [ "$BEFORE_SHA" != "0000000000000000000000000000000000000000" ]; then
if git rev-parse --verify "$BEFORE_SHA^{commit}" >/dev/null 2>&1; then
# Push events compare the before and after commit trees directly;
# PR events use base...HEAD above to match GitHub's pull request diff.
files=$(git diff --name-only "$BEFORE_SHA" HEAD -- '*.go' | tr '\n' ',' | sed 's/,$//')
else
echo "Before SHA $BEFORE_SHA not found, skipping push diff"
fi
fi
Comment on lines +1390 to +1398

echo "files=$files" >> "$GITHUB_OUTPUT"
if [ -n "$files" ]; then
echo "linting files: $files"
else
echo "No changed Go files to lint"
fi

- name: Run errormessage linter on changed files
if: steps.errormessage-scope.outputs.files != ''
env:
CHANGED_GO_FILES: ${{ steps.errormessage-scope.outputs.files }}
run: /tmp/gh-aw-linters -errormessage -errormessage.changed-files="$CHANGED_GO_FILES" ./...

- name: Run custom linters (wasm)
run: GOOS=js GOARCH=wasm make golint-custom LINTER_FLAGS="-errstringmatch -panicinlibrarycode -manualmutexunlock -osexitinlibrary -rawloginlib -logfatallibrary -regexpcompileinfunction -fprintlnsprintf -strconvparseignorederror -jsonmarshalignoredeerror -uncheckedtypeassertion -fmterrorfnoverbs -tolowerequalfold -httpnoctx -timeafterleak -errortypeassertion -execcommandwithoutcontext -sprintfint -stringsindexcontains -stringscountcontains -bytesbufferstring -ioutildeprecated -mapclearloop -mapdeletecheck -sprintfbool -appendoneelement -timenowsub -stringsjoinone -writebytestring -lenstringsplit -stringreplaceminusone -osgetenvlibrary -ossetenvlibrary -stringsindexhasprefix -ctxbackground -wgdonenotdeferred -goroutinemissingrecover -trimleftright -walkfuncerrshadow -uncheckedflushreturn -bytescomparestring -nilctxpassed -stringbytesroundtrip -fileclosenotdeferred -timesleepnocontext -sprintferrorsnew -globwalkignorederror -appendbytestring -sortslice -deferinloop -regexpdynamicpattern -test=false" LINTER_PACKAGES="./pkg/console ./pkg/parser ./pkg/styles ./pkg/tty ./pkg/workflow"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/error-message-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
if: steps.changed.outputs.files != ''
env:
CHANGED_GO_FILES: ${{ steps.changed.outputs.files }}
run: /tmp/gh-aw-linters -errormessage.changed-files="$CHANGED_GO_FILES" ./...
run: /tmp/gh-aw-linters -errormessage -errormessage.changed-files="$CHANGED_GO_FILES" ./...

- name: Check for bare fmt.Println/Printf in pkg/cli
run: |
Expand Down
Loading