Skip to content

Fix failing golangci-lint in CI #1330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 2, 2025
Merged

Fix failing golangci-lint in CI #1330

merged 3 commits into from
Apr 2, 2025

Conversation

kachick
Copy link
Collaborator

@kachick kachick commented Apr 2, 2025

#1287 以降 golangci-lint でCIが落ちている

jsonschema: "" does not validate with "/additionalProperties": additional properties 'skip-dirs' not allowed
Failed executing command with error: the configuration contains invalid elements
, Error: Command failed: /home/runner/golangci-lint-1.63.4-linux-amd64/golangci-lint config verify
jsonschema: "" does not validate with "/additionalProperties": additional properties 'skip-dirs' not allowed
Failed executing command with error: the configuration contains invalid elements

ログとか upstream の更新状況を見る限り https://github.com/golangci/golangci-lint-action/releases/tag/v6.5.0 で verify option がデフォルトで有効にされたため、もともと壊れていたが気付けなかった config schema の古さから落ちるようになったと思われる

golangci/golangci-lint-action#1171

通ってたとき

Run golangci/golangci-lint-action@v6
  with:
    version: v1.6[3](https://github.com/pankona/hashira/actions/runs/12844075664/job/35816704431#step:4:3).4
    install-mode: binary
    github-token: ***
    only-new-issues: false
    skip-cache: false
    skip-save-cache: false
    problem-matchers: false
    cache-invalidation-interval: [7](https://github.com/pankona/hashira/actions/runs/12844075664/job/35816704431#step:4:7)

落ちるようになってから

Run golangci/golangci-lint-action@v6
  with:
    version: v1.6[3](https://github.com/pankona/hashira/actions/runs/14202665657/job/39793024992#step:4:3).4
    install-mode: binary
    github-token: ***
    verify: true
    only-new-issues: false
    skip-cache: false
    skip-save-cache: false
    problem-matchers: false
    cache-invalidation-interval: [7](https://github.com/pankona/hashira/actions/runs/14202665657/job/39793024992#step:4:7)

https://github.com/golangci/golangci-lint/blob/544018f712a7506c49ecdb75b8cb5a4e7bbb7534/docs/src/docs/product/migration-guide.mdx#runskip-dirs みたいな変更をかければ直ると思うけれど、再現性が無いとどちらにせよキツイのでまず GHA のバージョンであることの確認後に今後は該当アクションのメジャーバージョンかつタグのみ利用を避ける。そんで config 更新して通れば滞留している dependabot PRs をマージしてヨシとする

Comment on lines +1 to +2
issues:
exclude-dirs:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この config 自体は golangci-lint config verify で verify をかけられるんだけれど、migrationガイドに沿って一足飛びに v2 系の linters.exclusions に差し替えようとするとやはり落ちる。
schema に version が用意されたのも最近の様で、指定ができない
migration tool も v1 時代から deprecate だった config には対応していないらしい
ということで、一旦古い情報を探すと golangci/golangci-lint#4509 での更新内容に添わせれば一旦通るようだった。
v2 系に上げるときには再度見直しが必要っぽいけどとりあえずこれで

@kachick kachick changed the title Ensure golangci-lint will pass if downgrade the action to 6.4.1 Fix failing golangci-lint in CI Apr 2, 2025
@kachick kachick marked this pull request as ready for review April 2, 2025 05:15
@kachick kachick requested a review from pankona as a code owner April 2, 2025 05:15
@@ -41,6 +41,6 @@ jobs:
with:
go-version-file: "go.mod"
cache-dependency-path: "go.sum"
- uses: golangci/golangci-lint-action@v6
- uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0
Copy link
Collaborator Author

@kachick kachick Apr 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

敢えてこのトラブルが発生しだした一番古いversionに止めてある
これ以降の更新は dependabot が出してくるはずなのでそれ単位で

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant