Skip to content

fix(golangci-lint): fix forcetypeassert errors #1933

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

Conversation

chmouel
Copy link
Member

@chmouel chmouel commented Feb 14, 2025

Go 1.22 introduced a restriction where type assertions in multiple assignments must be standalone.

This fix ensures compliance by:

  • Separating type assertions before passing values to functions.
  • Adding error handling for failed assertions to prevent runtime panics.
  • Consolidating duplicate cases for cleaner logic.

This resolves golangci-lint 'forcetypeassert' errors.

Fixes #1932

Go 1.22 introduced a restriction where type assertions in multiple
assignments must be standalone.

This fix ensures compliance by:
- Separating type assertions before passing values to functions.
- Adding error handling for failed assertions to prevent runtime panics.
- Consolidating duplicate cases for cleaner logic.

This resolves golangci-lint 'forcetypeassert' errors.

Fixes openshift-pipelines#1932

Signed-off-by: Chmouel Boudjnah <[email protected]>
@chmouel
Copy link
Member Author

chmouel commented Feb 14, 2025

/label fix

Copy link

✅ Added labels: fix.

@chmouel chmouel added bug Something isn't working ci and removed fix labels Feb 14, 2025
@zakisk
Copy link
Contributor

zakisk commented Feb 14, 2025

/lgtm

Copy link

@pipelines-as-code pipelines-as-code bot left a comment

Choose a reason for hiding this comment

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

✅ Pull Request Approved

Approval Status:

  • Required Approvals: 1
  • Current Approvals: 1

👥 Approved By:

Reviewer Permission Status
@zakisk admin

📝 Next Steps

  • All required checks must pass
  • Branch protection rules apply
  • Get a maintainer to use the /merge command to merge the PR

Thank you for your contributions! 🎉

@chmouel
Copy link
Member Author

chmouel commented Feb 14, 2025

/merge

@pipelines-as-code pipelines-as-code bot merged commit 5b6a223 into openshift-pipelines:main Feb 14, 2025
5 checks passed
Copy link

✅ PR Successfully Merged

  • Merge method: rebase
  • Merged by: @chmouel
  • Total approvals: 1/1

Approvals Summary:

Reviewer Permission Status
@zakisk admin

@chmouel chmouel deleted the fix/1932-new-errors-with-golangci-lint-1.64 branch February 14, 2025 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ci
Development

Successfully merging this pull request may close these issues.

new errors with golangci-lint 1.64
3 participants