PR for CI test #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: golangci-lint | |
on: | |
push: | |
tags: | |
- v* | |
branches: | |
# $default-branch | |
- master | |
- 'release-*' | |
- 'dev-*' | |
pull_request: | |
merge_group: | |
permissions: | |
contents: read | |
# Optional: allow read access to pull request. Use with `only-new-issues` option. | |
# pull-requests: read | |
jobs: | |
golangci: | |
name: golangci-lint | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
mode: [no-failure] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.20' | |
cache: false | |
check-latest: true | |
# https://github.com/golangci/golangci-lint/issues/3862#issuecomment-1572973588 | |
- run: echo "GOROOT=$(go env GOROOT)" >> $GITHUB_ENV | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: latest | |
args: --timeout=3m | |
${{ matrix.mode == 'no-deprecations' && '--exclude=^SA1019' || '' }} | |
${{ matrix.mode == 'no-failure' && '--issues-exit-code=0' || '' }} | |
# for pull requests, show only new issues | |
# Too bad it's incompatible with working-directory. | |
# only-new-issues: true | |
only-new-issues: false | |
working-directory: ./golang/cosmos | |
- name: forbid %w error-wrapping format specifier | |
run: | | |
set -e | |
if find ./golang/cosmos -name '*.go' ! -name '*_test.go' -print0 | xargs -0 grep '%w'; then | |
echo "Found %w in ./golang/cosmos; please use %s instead." | |
exit 1 | |
fi |