x/tools/cmd/callgraph: calls from unreachable unexported methods not reported in callgraph #66251
Labels
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
Go version
go version go1.22.0 darwin/amd64
Output of
go env
in your module/workspace:What did you do?
go.mod
example2/main.go
Ran
callgraph -algo={algo} ./example2
foralgo
in[static, cha, rta, vta]
What did you see happen?
callgraph -algo=static ./example2
callgraph -algo=cha ./example2
callgraph -algo=rta ./example2
callgraph -algo=vta ./example2
What did you expect to see?
callgraph -algo=static ./example2
callgraph -algo=cha ./example2
callgraph -algo=rta ./example2
This is because rta only includes reachable funcs by design
callgraph -algo=vta ./example2
Note that the link from
example2.unexported).Func1
tocalled
is present whenexample2.unexported).Func1
is forced to be reachable. For example:example2/main.go
callgraph -algo=static ./example2
callgraph -algo=cha ./example2
callgraph -algo=rta ./example2
This is because rta only includes reachable funcs by design
callgraph -algo=vta ./example2
This likely has to do with the same usage of
ssautil.AllFunctions
(at least for vta) that resulted in this bug for thedeadcode
command.The text was updated successfully, but these errors were encountered: