/usr/share/gocode/src/github.com/ctdk/goiardi/digraph/graphviz.go is in golang-github-ctdk-goiardi-dev 0.11.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | package digraph
import (
"fmt"
"io"
)
// WriteDot is used to emit a GraphViz compatible definition
// for a directed graph. It can be used to dump a .dot file.
func WriteDot(w io.Writer, nodes []Node) error {
w.Write([]byte("digraph {\n"))
defer w.Write([]byte("}\n"))
for _, n := range nodes {
nodeLine := fmt.Sprintf("\t\"%s\";\n", n)
w.Write([]byte(nodeLine))
for _, edge := range n.Edges() {
target := edge.Tail()
line := fmt.Sprintf("\t\"%s\" -> \"%s\" [label=\"%s\"];\n",
n, target, edge)
w.Write([]byte(line))
}
}
return nil
}
|