CodeQL library for Go
codeql/go-all 0.7.15-dev (changelog, source)
Search

Member predicate Public::CallNode::getReceiver

Gets the data flow node corresponding to the receiver of this call, if any.

When a method value is assigned to a variable then when it is called it looks like a function call, as in the following example.

file, _ := os.Open("test.txt")
f := file.Close
f()

In this case we use local flow to try to find the receiver (file in the above example).

Node getReceiver()