blushft / go-diagrams

Create beautiful system diagrams with Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Render method errors on subsequent runs (file exists)

Blokje5 opened this issue · comments

When running a go-diagram more then once, the Render method errors with the following message:

mkdir go-diagrams: file exists

Ideally Render supports the option to overwrite the dot file in the go-diagrams directory.

commented

This bug is here:

if err := os.Mkdir(outdir, os.ModePerm); err != nil {

This is still present, and is present in a few occurrences (in diagaram/diagram.go and in diagram/node.go; as well as some similar occurrences in cmd/gen/main.go)

To fix this, we can check if the error is an os.ErrExist error. I will open a fork and PR for this, soon.

linked the PR