ondrajz / go-callvis

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

go-callvis for quorum packages #22

Closed Richcardin closed 6 years ago

Richcardin commented 6 years ago

git clone https://github.com/jpmorganchase/quorum.git Iam trying this command go-callvis -focus upgrade -group pkg,type -limit github.com/jpmorganchase/quorum github.com/jpmorganchase/quorum

output- go-callvis: cannot find package "upgrade" in any of: /usr/local/go/src/upgrade (from $GOROOT) /home/ubuntu/go/src/upgrade (from $GOPATH)

sjeeva commented 6 years ago

incidentally I also stumbled on the same issue!! Any thoughts on how to resolve this?

ondrajz commented 6 years ago

Target needs to be a program. github.com/jpmorganchase/quorum doesn't seem to be a program. Try one of the programs in cmd folder.

MichaelMure commented 6 years ago

@TrueFurby any plan to support libraries ?

ondrajz commented 6 years ago

Main package (program) is required for the analysis used, because all the calls in the callgraph tree begins in main (and inits).

In normal package (library) you don't really know what will be called, since it's just a package without some start point. Program that will use the package can call anything or nothing.

MichaelMure commented 6 years ago

Instead of a single entry point (main()) you could have multiple entry points (every exported function).

But I understand it might not be easy or even possible depending on the code you have. Just stating that it would be very helpful to understand a codebase.

ondrajz commented 6 years ago

You easily do that by creating a simple program and placing all the calls you are interested in, for example exported functions of some package, and running go-callvis on that program.