Skip to content

Instantly share code, notes, and snippets.

View jansemmelink's full-sized avatar

Jan Semmelink jansemmelink

  • Johannesburg, South Africa
View GitHub Profile
@jansemmelink
jansemmelink / if-else-undo-done.md
Created August 31, 2018 19:45
Go Error Handling with if-else-undo-done

Go Error Handling with If-Else-Undo-Done

Introduction

This is my proposal for handling errors in a new version of Go. This is part of the ongoing public discussion at [https://github.com/golang/go/wiki/Go2ErrorHandlingFeedback]

My proposal does not make code shorter, but provides easier error handling and cleanup.

If-Else-Undo-Done

I prefer to stick to the Go language conventions and create an extension to an if statement. Consider this: