]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: document that Caller and Frame.File always use forward slashes
authorqmuntal <quimmuntal@gmail.com>
Tue, 6 Aug 2024 09:02:35 +0000 (11:02 +0200)
committerQuim Muntal <quimmuntal@gmail.com>
Fri, 25 Oct 2024 16:18:18 +0000 (16:18 +0000)
Document that Caller and Frame.File always use forward slashes
as path separators, even on Windows.

Fixes #3335

Change-Id: Ic5bbf8a1f14af64277dca4783176cd8f70726b91
Reviewed-on: https://go-review.googlesource.com/c/go/+/603275
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/runtime/extern.go
src/runtime/symtab.go

index f8f81be8ef4357b94bb4b01461ba36f603eefaa4..fad19b9449a5eb0f46a149113fa558c506e16f11 100644 (file)
@@ -294,10 +294,11 @@ import (
 
 // Caller reports file and line number information about function invocations on
 // the calling goroutine's stack. The argument skip is the number of stack frames
-// to ascend, with 0 identifying the caller of Caller.  (For historical reasons the
-// meaning of skip differs between Caller and [Callers].) The return values report the
-// program counter, file name, and line number within the file of the corresponding
-// call. The boolean ok is false if it was not possible to recover the information.
+// to ascend, with 0 identifying the caller of Caller. (For historical reasons the
+// meaning of skip differs between Caller and [Callers].) The return values report
+// the program counter, the file name (using forward slashes as path separator, even
+// on Windows), and the line number within the file of the corresponding call.
+// The boolean ok is false if it was not possible to recover the information.
 func Caller(skip int) (pc uintptr, file string, line int, ok bool) {
        rpc := make([]uintptr, 1)
        n := callers(skip+1, rpc)
index 88780b8cbf35c003f03279dd073ab85661b73f6b..73e0c700650103f13a832b78f49e97eb1669177a 100644 (file)
@@ -49,7 +49,8 @@ type Frame struct {
        // File and Line are the file name and line number of the
        // location in this frame. For non-leaf frames, this will be
        // the location of a call. These may be the empty string and
-       // zero, respectively, if not known.
+       // zero, respectively, if not known. The file name uses
+       // forward slashes, even on Windows.
        File string
        Line int