Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document compatible graphviz versions #18

Open
Merovius opened this issue Jan 25, 2018 · 3 comments
Open

Document compatible graphviz versions #18

Merovius opened this issue Jan 25, 2018 · 3 comments
Milestone

Comments

@Merovius
Copy link
Contributor

I'm getting syntax errors when trying to run the output through dot, for example:

axelw@axelw-1 ~/src/github.com/bradleyjkemp/memmap/.snapshots$ dot TestFib 
Error: TestFib: syntax error in line 1 near '('

I assume I don't have a sufficiently recent version of graphviz installed, this is dot -version:

dot - graphviz version 2.38.0 (20140413.2041)
libdir = "/usr/lib/graphviz"
Activated plugin library: libgvplugin_dot_layout.so.6
Using layout: dot:dot_layout
Activated plugin library: libgvplugin_core.so.6
Using render: dot:core
Using device: dot:dot:core
The plugin configuration file:
	/usr/lib/graphviz/config6a
		was successfully loaded.
    render	:  cairo dot fig gd map pic pov ps svg tk vml vrml xdot
    layout	:  circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
    textlayout	:  textlayout
    device	:  canon cmap cmapx cmapx_np dot eps fig gd gd2 gif gv imap imap_np ismap jpe jpeg jpg pdf pic plain plain-ext png pov ps ps2 svg svgz tk vml vmlz vrml wbmp x11 xdot xdot1.2 xdot1.4 xlib
    loadimage	:  (lib) eps gd gd2 gif jpe jpeg jpg png ps svg xbm
@bradleyjkemp
Copy link
Owner

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.

@Merovius
Copy link
Contributor Author

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 :)

@bradleyjkemp
Copy link
Owner

Ah nice catch, yeah I hadn't considered strings with quotes in them.

And agreed, documentation definitely needs a lot of work...

@bradleyjkemp bradleyjkemp added this to the V1 milestone Jan 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants