Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
proposal: allow to use return statement with function's call uniformly. #39225
I suggest that you allow using the expression of the
In accordance with the https://golang.org/ref/spec#Return_statements,:
It makes impossible to use following syntax:
and produces the error:
In the same time, with functions that returns values, it's allowed:
I suggest to modify the specification:
With suggested changes, this code could be shortened to:
It will allow to reduce the number of lines with error check slightly and decrease the verbosity of code.
While I see the intent is to reduce verbosity, I don't think this would be a good change to make.
I think you should look at https://go.googlesource.com/proposal/+/master/design/go2draft-error-handling-overview.md.