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

Escape API doesn't properly escape nodes with file names #69

Closed
kevin-hanselman opened this issue Oct 16, 2020 · 3 comments
Closed

Escape API doesn't properly escape nodes with file names #69

kevin-hanselman opened this issue Oct 16, 2020 · 3 comments

Comments

@kevin-hanselman
Copy link

A minimal example:

package main

import (
        "fmt"
        gv "github.com/awalterschulze/gographviz"
)

func main() {
        graph := gv.NewEscape()
        graph.SetName("G")
        graph.AddNode("G", "a.txt", nil)
        graph.AddNode("G", "b.txt", nil)
        fmt.Println(graph.String())
}

Output:

$ go run main.go
graph G {
        a.txt;
        b.txt;

}

$ go run main.go | dot -Tpng -o out.png
Error: <stdin>: syntax error in line 2 near '.'
@kevin-hanselman kevin-hanselman changed the title Escape API doesn't properly escape file names Escape API doesn't properly escape nodes with file names Oct 16, 2020
@awalterschulze
Copy link
Owner

Great catch, thank you for reporting.
Would you like to make a pull request to fix?

@kevin-hanselman
Copy link
Author

kevin-hanselman commented Oct 18, 2020

Turns out go mod was using the latest tagged release (2.0.1 from April) instead of master; this issue is not present on master. (I'm fairly new to Go and Go modules, so I didn't realize this was the default behavior of go mod.)

It might be a good idea to cut a new release to prevent this sort of confusion?

@awalterschulze
Copy link
Owner

Great idea and thanks for pointing it out.
I have made a new release v2.0.2
This includes the escaping of the dot.
I hope that helps.

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