Updates aws/aws-xray-sdk-go#77
Updates evalphobia/logrus_sentry#74
Go 1.12 has updated the behaviour of runtime.FuncForPC so that it
behaves as it did in Go 1.11 and earlier.
This allows errors.Frame to return to a uintptr representing the PC +1
of the caller. This will fix the build breakages of projects that were
tracking HEAD of this package.
Signed-off-by: Dave Cheney <dave@cheney.net>
With Go 1.12, we will now be doing mid-stack inlining. This exposes
inlined frames to runtime.Callers and friends.
The spec says that a runtime.Frame may have a nil Func field for
inlined functions. Instead, use the Function field to detect whether
we really have an empty Frame.
Avoid the unnecessary conversions from errors.Frame to
runtime.Frame to access the latter's fields as by definition the former
also has the same fields.
Signed-off-by: Dave Cheney <dave@cheney.net>
Remove support for Go 1.8 and earlier as they are
a. no longer supported upstream
b. lack support for runtime.CallerFrames
Signed-off-by: Dave Cheney <dave@cheney.net>
toperr is not used, but the go compiler itself doesn't detect this
because it's within an anonymous function. However, go/types does
detect this as being unused, which causes any static analysis tools
which uses go/types' type checker to fail with the message "toperr
assigned and not used".
The final result of the benchmarked function is instead assigned to
an exported global variable to ensure the compiler cannot now, nor
in the future optimise away the function calls due to no observable
side effects.
It was chosen to assign the final result, after the benchmark loop,
to the global variable, as this best follows the example set in the
CL https://go-review.googlesource.com/#/c/37195/. As opposed to
having each call to f assign to the global. This also appears to
better align with the original author's intention of toperr.
This change had no observable impact on the benchmark.
Related https://github.com/golang/go/issues/3059.
Related https://github.com/golang/go/issues/8560.
Thanks dominikh for additional clarifications.
Adds testFormatCompleteCompare as additional testing func.
The new function takes a string slice as "want", wherein
stacktraces and non-stacktrace messages are discerned by
strings.ContainsAny(want[i], "\n").
For example usage, see TestFormatWithStack & TestFormatWithMessage.