Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
runtime: add GODEBUG=inittrace=1 support #41378
Note: Like #38714 this is not a proposal for the proposal process.
This issue is to discuss and track the addition of support for init function tracing through GODEBUG for ad hoc debugging and profiling of init start times.
For the first minimal implementation (future iterations can expand functionality) I think that just showing the package name, start time of the init function, wall clock duration and total heap allocated bytes and number of allocs is sufficient. Later information like module version could be added.
Due to larger complexity and limited utility init tracing of plugins is not supported.
Having a more structured format like json output is omitted and likely needs a more holistic approach and decision in unison with adding support for gctrace in json format too.
Prototype CL: https://go-review.googlesource.com/c/go/+/254659
In principle possible with the following caveats that come into my mind (im sure there are more):