Closed edson-dev closed 2 years ago
See https://github.com/golang/go/issues?q=+label%3Aerror-handling+ for all the previous related error handling proposals.
Please use the forums for general discussions
Closing as this does not appear to be a well fleshed out proposal that can be evaluated.
I start work with go for some time already and I really like the language. But a thing keeps annoying me for some time... the main problem for me is the error handler for errors and I know that is a really well-debated point of many people that are developing in go. So I decide to write my idea here just to give my 2 cents for the discussion and if anyone thinks it's interesting we can proceed to make a proposal for that.
i understand that are 2 times in a error, been 1st one identifying and then handling then, so for my development, I keep writing the same code(its just an example... i use log and all, but the idea is the same) or hiding the errors with _(I know that's not best practice, but we need to identify the errors before we handle then).
x, err := y() if err != nil { print(err) }
output: unexpected end of JSON input
and its not readable... because I have 3/4 of my lines of code on this error print stuff... so my idea is to have a token like '_', lets call it '~' that when have a value attributed it self print on console log or any other way. That solution will cover all default console log for development and if you need a really error handler it will be in the code like...
propose
x, ~ := y()
output: unexpected end of JSON input