Skip to content

Instantly share code, notes, and snippets.

View marlonche's full-sized avatar

chef marlonche

  • China
View GitHub Profile

How about separating check and handle as follows:

  1. handle can just works like defer as the draft suggested(called after return in reversed order of definition), and the magic identifier err could be changed to any error varible decalared, not the result of check.

  2. The error result as the last return value of a function should not be omitted in the presence of check.

  3. The return statements in handle just return the handle scope, not the function scope.

  4. Restrict functions to use named result parameters when using check.