You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example declares a global variable which indirectly calls runtime.Caller, which returns <autogenerated> instead of the actual filename.
A main function prints an error with the returned filename if it doesn't contain package1. It can run with go run main.go.
If this is not considered a bug, the documentation should make it clear that runtime.Caller can return something else when called from a global variable.
What did you expect to see?
runtime.Caller should return <root>/mypackage1/myfile.go.
What did you see instead?
runtime.Caller returns <autogenerated>.
The text was updated successfully, but these errors were encountered: