Skip to content

proposal: spec: simplify error handling's IF statement #73002

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

Closed
3 of 4 tasks
tomaszbk opened this issue Mar 22, 2025 · 2 comments
Closed
3 of 4 tasks

proposal: spec: simplify error handling's IF statement #73002

tomaszbk opened this issue Mar 22, 2025 · 2 comments
Labels
LanguageChange Suggested changes to the Go language LanguageChangeReview Discussed by language change review committee LanguageProposal Issues describing a requested change to the Go language specification. Proposal
Milestone

Comments

@tomaszbk
Copy link

tomaszbk commented Mar 22, 2025

Go Programming Experience

Intermediate

Other Languages Experience

python, C, sql,

Related Idea

  • Has this idea, or one like it, been proposed before?
  • Does this affect error handling?
  • Is this about generics?
  • Is this change backward compatible? Breaking the Go 1 compatibility guarantee is a large cost and requires a large benefit

Has this idea, or one like it, been proposed before?

there are lot of error handling simplification proposals but this one is very simple

Does this affect error handling?

makes it shorter and more readable

Is this about generics?

No

Proposal

Besides the default

if err != nil {
}

Allow also for an easier and more readable:

if err {
}

Is this change backward compatible?

Yes

Would this change make Go easier or harder to learn, and why?

Easier

Cost Description

should be quite easy to implement

@tomaszbk tomaszbk added LanguageChange Suggested changes to the Go language LanguageChangeReview Discussed by language change review committee Proposal labels Mar 22, 2025
@gopherbot gopherbot added this to the Proposal milestone Mar 22, 2025
@randall77
Copy link
Contributor

Dup of #26712 #33115 and probably more.

@gabyhelp gabyhelp added the LanguageProposal Issues describing a requested change to the Go language specification. label Mar 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LanguageChange Suggested changes to the Go language LanguageChangeReview Discussed by language change review committee LanguageProposal Issues describing a requested change to the Go language specification. Proposal
Projects
None yet
Development

No branches or pull requests

4 participants