Closed picatz closed 10 months ago
This PR adds the callgraphutil.WriteCSV function which can write a given *callgraph.Graph in CSV format to an io.Writer.
callgraphutil.WriteCSV
*callgraph.Graph
io.Writer
Here are some examples of how to visualize this information with Observable:
Looking at calls from packages in this repository make to the Go standard library:
Looking at calls across tailscale:
tailscale
[!NOTE] That line going down the middle is when a package calls itself, which happens often it seems.
Here is another fun slice:
Or breaking down the same information as a stacked bar chart:
Or making a force directed graph:
data = { const csvData = await FileAttachment("tailscale.csv").csv(); const links = csvData.map(d => ({source: d.source_func, target: d.target_func})); const nodes = Array.from(new Set(links.flatMap(l => [l.source, l.target])), id => ({id})); return {nodes, links}; } ForceGraph(data, { nodeId: (d) => d.id, nodeTitle: (d) => d.id, width: 8000, height: 8000, invalidation // stop when the cell is re-run })
This is the one for Vault:
We can also break this information down by package, just need to change the source and targets to use different columns from our OSV:
data = { const csvData = await FileAttachment("vault.csv").csv(); const links = csvData.map(d => ({source: d.source_pkg, target: d.target_pkg})); const nodes = Array.from(new Set(links.flatMap(l => [l.source, l.target])), id => ({id})); return {nodes, links}; }
This is the one for Terraform:
This is the one for Nomad:
This is one for Mimir:
https://observablehq.com/d/d5a9ad2cb65e27c1
This PR adds the
callgraphutil.WriteCSV
function which can write a given*callgraph.Graph
in CSV format to anio.Writer
.Example
Here are some examples of how to visualize this information with Observable:
Looking at calls from packages in this repository make to the Go standard library:
Looking at calls across
tailscale
:Here is another fun slice:
Or breaking down the same information as a stacked bar chart:
Or making a force directed graph:
This is the one for Vault:
We can also break this information down by package, just need to change the source and targets to use different columns from our OSV:
This is the one for Terraform:
This is the one for Nomad:
This is one for Mimir: