1
0
mirror of https://github.com/golang/go synced 2024-09-30 22:18:32 -06:00

runtime: fix Caller

log: add test of Caller

New regexp in log test is picky and will require some
maintenance, but it catches off-by-one mistakes too.

Fixes #710.

R=gri
CC=esko.luontola, golang-dev
https://golang.org/cl/887043
This commit is contained in:
Russ Cox 2010-04-05 23:36:37 -07:00
parent a267ff6a81
commit 6d69fd1fe3
2 changed files with 2 additions and 2 deletions

View File

@ -17,7 +17,7 @@ const (
Rdate = `[0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]`
Rtime = `[0-9][0-9]:[0-9][0-9]:[0-9][0-9]`
Rmicroseconds = `\.[0-9][0-9][0-9][0-9][0-9][0-9]`
Rline = `[0-9]+:`
Rline = `(58|60):` // must update if the calls to l.Logf / l.Log below move
Rlongfile = `.*/[A-Za-z0-9_\-]+\.go:` + Rline
Rshortfile = `[A-Za-z0-9_\-]+\.go:` + Rline
)

View File

@ -479,7 +479,7 @@ void
{
Func *f;
if(callers(skip, &retpc, 1) == 0 || (f = findfunc(retpc-1)) == nil) {
if(callers(1+skip, &retpc, 1) == 0 || (f = findfunc(retpc-1)) == nil) {
retfile = emptystring;
retline = 0;
retbool = false;