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 UT can execute in Running mode, but panics in debug mode.
the if check on nil doesn't return true as it is a typed interface nil rather than the raw nil.
ifarg==nil { // <<< return falseswitchverb {
case'T', 'v':
p.fmt.padString(nilAngleString)
default:
p.badVerb(verb)
}
return
}
...switchverb {
case'v', 's', 'x', 'X', 'q':
// Is it an error or Stringer?// The duplication in the bodies is necessary:// setting handled and deferring catchPanic// must happen before calling the method.switchv:=p.arg.(type) {
caseerror:
handled=truedeferp.catchPanic(p.arg, verb, "Error")
p.fmtString(v.Error(), verb)
returncaseStringer:
handled=truedeferp.catchPanic(p.arg, verb, "String")
p.fmtString(v.String(), verb) // <<<<< calls here because the embed Bar implmeent the String()string interface. v is nilreturn
}
}
What did you expect to see?
debug should run well and also print as running:
<nil>
The text was updated successfully, but these errors were encountered:
Could you explain what are "Running mode" and "debug mode"? The Go toolchain and standard library don't have those mode.
If you're running in an IDE, it could be that the code panics and recovers, but the IDE's debugger captures the first panic and pauses the execution. If that is the case, you should be able to continue the execution and let it recover.
Go version
all go versions up to 1.21.6
Output of
go env
in your module/workspace:What did you do?
i run the following test case, and everything runs well. but when i debug, it panics.
What did you see happen?
the UT can execute in Running mode, but panics in debug mode.
the if check on
nil
doesn't return true as it is a typed interface nil rather than the raw nil.What did you expect to see?
debug should run well and also print as running:
The text was updated successfully, but these errors were encountered: