Skip to content
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

chore: use errors.Is to compare errors in generated code #4971

Merged
merged 1 commit into from
Nov 21, 2024

Conversation

mmorel-35
Copy link
Contributor

@mmorel-35 mmorel-35 commented Nov 20, 2024

Description

This uses errors.Is to compare errors in generated code.

This the recommended way to compare errors (with erros.As but do not apply here). There is a linter (errorlint) that ensure this.

@mmorel-35 mmorel-35 changed the title chore: use errors.Is to compare with io.EOF in generated code chore: use errors.Is to compare errors in generated code Nov 20, 2024
@mmorel-35 mmorel-35 marked this pull request as draft November 20, 2024 06:47
@mmorel-35 mmorel-35 force-pushed the template/errors-is branch 2 times, most recently from 58810aa to ccecc38 Compare November 20, 2024 07:03
@mmorel-35 mmorel-35 marked this pull request as ready for review November 20, 2024 07:12
Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

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

I'm OK with using errors.Is for io.EOF, but please leave err != nil the same as it was.

protoc-gen-grpc-gateway/internal/gengateway/template.go Outdated Show resolved Hide resolved
@mmorel-35 mmorel-35 marked this pull request as ready for review November 21, 2024 06:47
@johanbrandhorst johanbrandhorst merged commit 26d134f into grpc-ecosystem:main Nov 21, 2024
14 checks passed
@johanbrandhorst
Copy link
Collaborator

Thanks for your contribution!

@mmorel-35 mmorel-35 deleted the template/errors-is branch November 21, 2024 17:27
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.

2 participants