Closed myaaaaaaaaa closed 2 months ago
Related Issues and Documentation
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
making code behave differently in tests than in normal operation sounds like a source for confusion. Like many testing functionality like race detection and coverage, it should be opt in, like it is now with GODEBUG.
This would almost certainly break existing users who parse stack traces.
The information would be sometimes useful and sometimes not. Many servers can have hundreds or thousands of goroutines that all started at the same place, such as the server's call to Accept
. Dumping the stack trace of the Accept
call hundreds of times, even if only in a test, serves nobody.
Since we already have a way to do this, I'm going to close this proposal. Sorry.
Proposal Details
By default, a panicking goroutine's stack trace ends at the
go
line:The
GODEBUG=tracebackancestors
environment variable addresses this. Presumably, it has some kind of runtime cost that prevents it from being set by default - hence, this proposal to have it apply only during testing.Having this on by default would improve the debugging experience for all users who need to work with goroutines.