I switched to go modules recently and I can't seem to make pprof recognize the source files. Maybe someone here knows how to?
I tried using the -source_path and -trim_path options but I can't figure it out how to make it work.
Interestingly, typing o in the interactive mode of pprof shows the the trim_path option but not the source_path.
Just to be sure: pprof does work with local modules and showing their sources in the stack traces, right?
It does work, I just figured it out.
You need to use both -trim_path and -source_path together.
-source_path should be set to the absolute path to your source code.
-trim_path should be set to the path that go tool pprof is saying the code should be at.
So if pprof is saying the path does not exist at /abc/your/code/main.go then set the trim path to /abc/your/code/ make sure that the -source_path contains the main.go though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With