From 64cef142c75cc9e2174a4ad2f93375976f2efec0 Mon Sep 17 00:00:00 2001 From: jackyzha0 Date: Sun, 18 Jul 2021 11:01:42 -0400 Subject: [PATCH] add do not edit message --- main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 03e805d..75a6fda 100644 --- a/main.go +++ b/main.go @@ -111,6 +111,7 @@ func index(links []Link) (index Index) { return index } +const message = "# THIS FILE WAS GENERATED using github.com/jackyzha0/hugo-obsidian\n# DO NOT EDIT\n" func write(links []Link, out string) error { index := index(links) resStruct := struct{ @@ -125,7 +126,7 @@ func write(links []Link, out string) error { return mErr } - writeErr := ioutil.WriteFile(path.Join(out, "linkIndex.yaml"), marshalledIndex, 0644) + writeErr := ioutil.WriteFile(path.Join(out, "linkIndex.yaml"), append([]byte(message), marshalledIndex...), 0644) if writeErr != nil { return writeErr }