More efficient front matter processor

This commit is contained in:
Mike Farah
2021-07-20 10:38:42 +10:00
parent 4e628327c4
commit 8508d3309b
6 changed files with 49 additions and 53 deletions
+1 -4
View File
@@ -98,10 +98,7 @@ func evaluateAll(cmd *cobra.Command, args []string) error {
args[firstFileIndex] = frontMatterHandler.GetYamlFrontMatterFilename()
if frontMatter == "process" {
reader, err := os.Open(frontMatterHandler.GetContentFilename()) // #nosec
if err != nil {
return err
}
reader := frontMatterHandler.GetContentReader()
printer.SetAppendix(reader)
defer yqlib.SafelyCloseReader(reader)
}
+1 -4
View File
@@ -112,10 +112,7 @@ func evaluateSequence(cmd *cobra.Command, args []string) error {
args[firstFileIndex] = frontMatterHandler.GetYamlFrontMatterFilename()
if frontMatter == "process" {
reader, err := os.Open(frontMatterHandler.GetContentFilename()) // #nosec
if err != nil {
return err
}
reader := frontMatterHandler.GetContentReader()
printer.SetAppendix(reader)
defer yqlib.SafelyCloseReader(reader)
}