x/tools/cmd/callgraph: calls to interface implementation not reported in cha callgraph #66429
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
Go version
go version go1.22.1 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
callgraph
callgraph -algo=cha .
in the directory ofexample.go
Output is
What did you see happen?
Output includes just
exampleA.InterfaceFn()
:What did you expect to see?
Output to also include
exampleB.InterfaceFn()
in addition toexampleA.InterfaceFn()
.Note this report is similar to this issue, but more specific to interfaces and reproduces regardless of whether the interface type is exported.
In particular:
NewA()
example above.NewB()
above.The issue persists regardless of whether or not the interface type is exported.
Findings so far
We've identified this commit resulted in the change of behaviour.
Prior to this commit, the callgraph for
example.go
contains both interface implementations. After the commit it includes justexampleA.InterfaceFn()
but notexampleB.InterfaceFn()
.From the commit I can see it's now expected for unexported types not to be included in the callgraph by default. Though I'd like to understand whether this change also intended to no longer include interface implementations in the callgraph in the example above.
The text was updated successfully, but these errors were encountered: