In my journey with go discovered that there are no stacktraces. so whenever something breaks, all we get an simple string error message without any information where is this is coming from. This is in stark contrast with other languages where I am used to seing detailed stacktraces
For example, below is the error message from apex
$ cat event.json | apex invoke --logs webhook
⨯ error parsing response: json: cannot unmarshal array into Go value of type map[string]interface {}
here its telling me that unmarshal to a map ins't working because event.json
is an array. We have unmarshal to interface{}
to support both arrays & maps.However, it doesn't tell me which file/line is causing this error.
Questions:
- What is way to quickly find which file/line this error coming from?
- In General, Are there tips/tricks which gophers use to get to the source of problem quickly from this string error message?
- is this how stack traces are for most go projects or there are any best practices that should be followed?