Skip to content

package graphprint

import "github.com/cloudboss/unobin/pkg/graphprint"

Package graphprint renders a runtime DAG as either a plain indented listing or a Graphviz DOT document. Both unobin's stack binaries (via pkg/runner) and the dev CLI (cmd/unobin/root/print-graph) share these renderers so the two paths produce identical output for the same graph.

Functions

func DOT

func DOT(out io.Writer, dag *runtime.DAG, name string)

DOT writes the DAG to out as a Graphviz directed graph named name. Edges to non-node addresses (like `input.X`) are skipped so the rendered graph contains only nodes the runtime actually executes.

func Plain

func Plain(out io.Writer, dag *runtime.DAG)

Plain writes the DAG to out as an indented listing: one node per stanza, with each outgoing edge prefixed by "->". Addresses are sorted lexicographically so the output is stable across runs.