I'm using runtime.Caller(0)
to return the file name:
_, file, _, ok := runtime.Caller(0)
if !ok {
// What should I do here?
}
I would like to know:
This is my first week using Go, so I might seem like stupid questions if you are already advanced, and I'm sorry for that.
Thanks in advance.
Why this function in specific doesn't provide an error?
That is opinion based.
What should I do if it fails? (Panic, fatal error?)
Whatever fits your needs.
What could be wrong to fail?
Everything. E.g. a binary stripped of debug information.
Should I validate at all?
Yes of course.