Closed suntong closed 7 years ago
Oh, is it because all non-public functions & types are ignored?
I even tried this:
go-callvis -group pkg,type -nostd $gpkg | dot -Tpng -o ~/out.png
But the result is still rather limited:
If so, the non-public functions & types are equally important (besides the public ones) for people to understand the package, when they are trying to how how things related, which is what go-callvis
for and why they are using it.
Please consider adding a switch to output those.
Thx.
I think I know why you might be confused. I will try to explain.
Both of your examples show expected output. Keep in mind that this tool only shows function calls. For example it won't show types, variables or constants. It can only show relation to a type if its method is called.
I assume that by non-public functions you meant unexported. The output always shows both unexported and exported functions. Currently there isn't any flag to omit them. In the Reference guide you can see the difference in visualization of those functions.
In your examples you can clearly see unexported function init
calling anonymous function init#1
. The reason why you don't see any calls from the main
package to some unexported function inside other package is because that's impossible in Go, since unexported functions can only be called inside package.
The important flag which controls what is shown in the output is -focus
flag. By default it is set to main
, that means it will only show function calls from and to the main
package. If you want to show calls inside other package you can use -focus
flag to change the shown package.
You can find more thorough explanation in the wiki: https://github.com/TrueFurby/go-callvis/wiki/Focusing-packages
Oh, that's the trick. Thanks a lot for the comprehensive explanation, and the wiki example too!
So, FTA, this works,
go-callvis -group pkg,type -focus="" -limit github.com/goreleaser $gpkg | dot -Tpng -o ~/screenshot.png
and generated this chart:
Hi,
I'm trying to chart
goreleaser
, from github.com/goreleaser/goreleaser, however, I only get this small chart out of the big package:I've tried,
But the results are the same for both cases.
This is big package with many types and sub-folders, how come the chart is so limited, and how can I see the whole picture?
PS. Here is its folder structure:
Within each folder there at least one or two types define.
Please help. Thanks!