Simplifying repetitive error handling in go