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

why not add some grammatical sugar like return_if_err(err)? #23029

SuperGod opened this issue Dec 7, 2017 · 1 comment


None yet
3 participants
Copy link

commented Dec 7, 2017

why not add some grammatical sugar like "return_if_err(err)"?
There are many code in my project :

	if err != nil {

sometimes, this code take up too much lines.
So,why not add some grammatical sugar like return_if_err(err)?

What version of Go are you using (go version)?

go 1.9

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on is best.

What did you expect to see?

What did you see instead?


This comment has been minimized.

Copy link

commented Dec 7, 2017

Syntactic sugar ideas for the if err != nil idiom are being discussed here: #21161. There are several proposals there, including a few similar to yours. Closing here, so we can keep the discussion in one place.

@ALTree ALTree closed this Dec 7, 2017

@golang golang locked and limited conversation to collaborators Dec 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.