Giter Site home page Giter Site logo

Comments (8)

suntong avatar suntong commented on August 21, 2024 2

Thanks a lot for your answer. I tried a lot of other packages afterwards, all worked fine. Then I suddenly realized that the ko package I was initially investigating was a generated code. :-( the worst one to pick. :-(

So, all good now. Thanks again for your help.

BTW, the graph I sent before, http://img.vim-cn.com/a3/c9865f9ef44f1994b760bb3c5c058c37838df0.png, was generated using go's native callgraph command, before I knew of go-callvis. There were much tedious manual cleanup afterward, that's why I'm interested in the automatically way provided by go-callvis. Thanks again for providing that.

from go-callvis.

ondrajz avatar ondrajz commented on August 21, 2024

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

In package 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.

from go-callvis.

suntong avatar suntong commented on August 21, 2024

Ok. Thanks.

from go-callvis.

suntong avatar suntong commented on August 21, 2024

Reopening the issue as I'm still unable to visualize call graph for Go libs, despite I've given it some start point:

go-callvis -group pkg,type -limit github.com/knq/xo github.com/knq/xo/examples/sqlite3 | dot -Tpng -o /tmp/out.png

and the result looks like this:

http://img.vim-cn.com/32/9823a165bf43ec1ce6fa5cacfee09b663543fe.png

I.e., the visualization is only limited within the "examples/sqlite3", but not down to the xo lib level, which is what I had hoped for, when using the -limit github.com/knq/xo parameter.

As a comparison, here is what the level of details of xo lib call graph I'm hoping to see --
http://img.vim-cn.com/a3/c9865f9ef44f1994b760bb3c5c058c37838df0.png

So it is possible then? Thanks.

from go-callvis.

ondrajz avatar ondrajz commented on August 21, 2024

By default the -focus flag is set to main so it only shows calls from and to that package.

You can use an empty string (-focus="") to show all the calls for the program. Although I warn you that it might generate huge output if you don't use -limit or -nostd.

from go-callvis.

suntong avatar suntong commented on August 21, 2024

Thanks a lot for your answer.

So I tried it:

go-callvis -group pkg,type -focus="" -limit github.com/knq/xo github.com/knq/xo/examples/sqlite3 | dot -Tpng -o /tmp/out.png

however, the result is almost like what I posted before:

http://img.vim-cn.com/70/d93fee55166de1f43504fd87e901b79c4fa7f7.png

Do you have a full command like above that I can try out myself please? It'd be great if you have and can try with any of the following packages:

github.com/andybalholm/cascadia/
github.com/beevik/etree/
github.com/deckarep/golang-set/
github.com/fatih/camelcase/
github.com/gnewton/chidley/
github.com/goji/
github.com/moovweb/gokogiri/
github.com/spf13/cobra/
github.com/zenazn/goji/

Or any smaller but useful packages that you have locally.

Thanks

from go-callvis.

ondrajz avatar ondrajz commented on August 21, 2024

I have tried project cobra's program github.com/spf13/cobra/cobra using:

go-callvis -group pkg -focus="" -limit github.com/spf13/cobra github.com/spf13/cobra/cobra | dot -Tpng -o cobra.png

Output:
cobra
Are you looking for something like this?

I don't really know what happens inside github.com/knq/xo/examples/sqlite3 since it's not published, but could it be that the output you got from go-callvis has the only calls that happen for that example (for github.com/knq/xo path prefix)?

from go-callvis.

ondrajz avatar ondrajz commented on August 21, 2024

By the way, what did you use to generate the graph you sent before? http://img.vim-cn.com/a3/c9865f9ef44f1994b760bb3c5c058c37838df0.png

from go-callvis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.