Skip to content

Commit

Permalink
Use go:embed to embed the default template content
Browse files Browse the repository at this point in the history
  • Loading branch information
YuukiARIA committed Aug 29, 2021
1 parent 9c8c59e commit 561f4d0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
9 changes: 9 additions & 0 deletions render/default_template.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Dangling .meta paths
{{- range .DanglingMetaPaths }}
- {{ . }}
{{- end }}

### Asset paths without .meta
{{- range .MetalessAssetPaths }}
- {{ . }}
{{- end }}
15 changes: 4 additions & 11 deletions render/render.go
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
package render

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

"github.com/YuukiARIA/unity-meta-checker/models"
)

const defaultTemplateContent = `### Dangling .meta paths
{{- range .DanglingMetaPaths }}
- {{ . }}
{{- end }}
### Asset paths without .meta
{{- range .MetalessAssetPaths }}
- {{ . }}
{{- end }}
`
//go:embed default_template.tpl
var defaultTemplateContent []byte

func GetDefaultTemplate() *template.Template {
return template.Must(template.New("default").Parse(defaultTemplateContent))
return template.Must(template.New("default").Parse(string(defaultTemplateContent)))
}

func LoadTemplate(path string) (*template.Template, error) {
Expand Down

0 comments on commit 561f4d0

Please sign in to comment.