/ go Public
language: Go 2: error handling meta issue #40432
Language & library change proposals that are about error handling.
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
A language change or incompatible library change
This is a meta issue to summarize the current state of proposed changes to the Go language to improve error handling.
This issue is intended to be a summary to be updated from time to time. It is not intended for discussion of error handling in Go or ways to improve it. The intent is to provide an overview for people interested in changing the language. The issue exists as an acknowledgement that this is a common topic for Go 2 language changes. It does not mean that the language will actually change in any way. It may change, or it may not.
In August 2018 @rsc published a problem overview of error handling, including an introduction of a draft design that was not implemented. That problem overview lists the following goals:
There have been many attempts to change the language to meet these goals. None have been accepted to date.
Many of the changes have been filed as Go 2 proposals, and can be found via the
error-handlinglabel. There has also been a great deal of discussion on various mailing lists, which we won't attempt to summarize here.
Some of the notable issues are (this list is not intended to be comprehensive):
trycould cause the function to return. Go currently has no flow control constructs at the expression level, other than
panicwhich does more than just return from a function.
?, that insert an error check in a function call or assignment.
?<variable>simplify handling of multiple-return-values #33074, proposal: Go 2: use symbol or function call in assignment for error handling #33150.
!or other character leads to a change in flow control.
if err != nil, to reduce boilerplate.
catchstatement for error handling #32611, proposal: "?" as "!= nil" #32845, proposal: Go 2:
onErrsimple macro for common case error handling. A #32437 counter-proposal. #32946.
The text was updated successfully, but these errors were encountered: