Skip to content
New issue

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

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

Already on GitHub? # to your account

[MERMAID] Shape attributes on node causes the mermaid exporter to crash #40

Closed
john-scalingo opened this issue Dec 2, 2024 · 2 comments

Comments

@john-scalingo
Copy link

The mermaid exporter crashes when there's a shape attribute on a node.

This is due to this code: https://github.com/emicklei/dot/blob/master/mermaid.go#L82-L84

Which expect the shape attribute to be of type shape where it can not be. This type is always string.

This can be easily reproduced with:

	graph := dot.NewGraph(dot.Directed)
	graph.Node("A").Box()
	graph.Edge(graph.Node("A"), graph.Node("B"))

	fmt.Println(dot.MermaidGraph(graph, dot.MermaidTopDown))

Which causes the following error:

panic: interface conversion: interface {} is string, not dot.shape

goroutine 1 [running]:
github.com/emicklei/dot.diagramGraph(0xc0000a8000, 0xc00007e020)
        /home/john/gocode/pkg/mod/github.com/emicklei/dot@v1.6.3/mermaid.go:83 +0xb94
github.com/emicklei/dot.diagram(0xc0000a8000, {0x4bd97a, 0x5}, 0x1)
        /home/john/gocode/pkg/mod/github.com/emicklei/dot@v1.6.3/mermaid.go:67 +0x545
github.com/emicklei/dot.MermaidGraph(...)
        /home/john/gocode/pkg/mod/github.com/emicklei/dot@v1.6.3/mermaid.go:39
main.main()
        /home/john/Documents/dotbug/test.go:14 +0x3b9
exit status 2
@emicklei
Copy link
Owner

emicklei commented Dec 2, 2024

thank you for reporting this. I will work on a solution

@john-scalingo
Copy link
Author

I confirm that release 1.6.4 seems to fix the issue.

Your reactivity is really impressive ! Thanks a lot for your help and for this awesome package.

@emicklei emicklei closed this as completed Jan 3, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants