Best practices: Use defer whenever possible Errors: Export/Return error as variable, it helps you to compare error easily, instead of comparing strings. Another way is to create a custom type to encapsulate message and defining error codes.