Skip to content

Instantly share code, notes, and snippets.

@jozef-slezak
jozef-slezak / go2_errors_using_semicolons.md
Last active February 27, 2019 19:48
Proposal for GO2 - use semicolons instead of check+handle

Semicolons might help to handle errors like this:

func f2() error {
  err := f1(); if err == nil { return nil }
  // ...
}

Pros:

  1. The code is very explicit (that means that every reader will understand what is happening in the code)