ondrajz / go-callvis

Visualize call graph of a Go program using Graphviz
https://ofabry.github.io/go-callvis
MIT License
5.93k stars 410 forks source link

Visualizing Specific Functions or Receivers #174

Open NV4RE opened 6 months ago

NV4RE commented 6 months ago

Description: Currently, go-callvis provides valuable insights by visualizing package dependencies. However, for a deeper understanding of the codebase, it would be immensely beneficial to visualize specific functions or receivers within a package. This enhancement would enable users to comprehend the intricate details of process and business logic within their code, facilitating better comprehension and debugging.

Proposed Solution: Introduce a feature within go-callvis that allows users to specify particular functions or receivers they wish to visualize. This could be achieved through command-line options or configuration files, enabling users to focus on the precise components of interest.

Benefits:

  1. Enhanced Understanding: Users can delve deeper into the behavior of specific functions or receivers, gaining insights into their interactions and dependencies.
  2. Improved Debugging: Visualizing specific components aids in identifying potential issues or bottlenecks within the codebase, streamlining the debugging process.
  3. Efficient Code Review: Developers can use targeted visualizations to review and optimize critical sections of code, fostering better code quality and performance.
  4. Business Logic Understanding: Visualization of specific functions facilitates a clearer understanding of the underlying business logic, promoting informed decision-making during development and maintenance.

Example Usage:

go-callvis --function main.CalculateVatForOrder ./cmd/bootstrap

This command would generate a visualization focusing solely on the CalculateVatForOrder function within the main package.

Thank you for considering this enhancement. It would undoubtedly enrich the capabilities of go-callvis and benefit its users significantly.