Open Merovius opened 6 years ago
Ah, no that's just an artifact of the snapshot testing. If you open .snapshots/TestFib you'll see that the output from memmap is wrapped in "bytes.Buffer(****)" as that's how I captured the output. If you run TestFib directly then it'll print the output to stdout as well and that should be valid.
Okay, you are correct, I misattributed the problem; I ran into issues and tried to reproduce them on known-good output but didn't know it's not known-good :)
There still is an issue, though, but it actually lies with memmap
then:
mero@hix /tmp/foo$ cat main.go 130
package main
import (
"os"
"github.com/bradleyjkemp/memmap"
)
type Foo struct {
Bar string
}
func main() {
f := Foo{`"Hello World"`}
memmap.Map(os.Stdout, &f)
}
mero@hix /tmp/foo$ go run main.go
digraph structs {
node [shape=Mrecord];
1 [label="<name> Foo |{<f0> Bar | \""Hello World"\"} "];
}
mero@hix /tmp/foo$ go run main.go | dot
Error: <stdin>: syntax error in line 3 near 'World'
string escaping seems broken, I sent a PR about that: #19
I think it would still be useful to document more the end-to-end process and the necessary version of graphviz, but at least my immediate problem is solved :)
Ah nice catch, yeah I hadn't considered strings with quotes in them.
And agreed, documentation definitely needs a lot of work...
I'm getting syntax errors when trying to run the output through dot, for example:
I assume I don't have a sufficiently recent version of graphviz installed, this is
dot -version
: