Skip to content

Commit

Permalink
embed the template file (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
KarnerTh authored Jul 3, 2022
1 parent 4f50b47 commit 1604b80
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (after version 0.0.5).

## [0.2.1] - 2022-06-03
### Fixed
- Embed the template file into the binary ([Issue #10](https://github.com/KarnerTh/mermerd/issues/10))


## [0.2.0] - 2022-06-01
### Added
- A `--debug` flag/config to show debug information
Expand Down Expand Up @@ -66,6 +71,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (after version 0.0
### Added
- Initial release of mermerd

[0.2.1]: https://github.com/KarnerTh/mermerd/releases/tag/v0.2.1

[0.2.0]: https://github.com/KarnerTh/mermerd/releases/tag/v0.2.0

[0.1.0]: https://github.com/KarnerTh/mermerd/releases/tag/v0.1.0
Expand Down
6 changes: 5 additions & 1 deletion diagram/diagram.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package diagram

import (
_ "embed"
"os"
"text/template"

Expand All @@ -10,6 +11,9 @@ import (
"github.com/KarnerTh/mermerd/database"
)

//go:embed erd_template.gommd
var erdTemplate string

type diagram struct {
config config.MermerdConfig
}
Expand All @@ -31,7 +35,7 @@ func (d diagram) Create(result *database.Result) error {

defer f.Close()

tmpl, err := template.ParseFiles("diagram/erd_template.gommd")
tmpl, err := template.New("erd_template").Parse(erdTemplate)
if err != nil {
logrus.Error("Could not load template file", " | ", err)
return err
Expand Down

0 comments on commit 1604b80

Please sign in to comment.