Skip to content

Instantly share code, notes, and snippets.

View einthusan's full-sized avatar

Einthusan Vigneswaran einthusan

  • Wojka Inc.
  • Toronto, Canada
View GitHub Profile
@einthusan
einthusan / errors-go2.go
Last active September 21, 2018 10:12
Go2 Error Aware Keywords - `return`, `defer`, `if`, and `!=` and forcing the error object to be the last argument
// THE GOAL of my proposal is to keep Go2 easy to read, which was it's number 1 strength.
// I am an ordinary programmer and therefore I don't know how difficult it will be to implement my proposal.
// I hope that Go2 can remain simple and easy to read.
// The syntax for Go error handling will ultimately rely on the changes to Go error types/values.
// If Go error handling syntax and Go error type is treated as 2 seperate topics,
// then Go2 errors as a whole will produce a solution that is not user friendly.
// the 'return' keyword only returns if the error != nil
// this means Go2's 'return' keyword will be aware of error types
// same as writing: if err != nil { return err }