about summary refs log tree commit diff stats
path: root/internal/builder/posts.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/builder/posts.go')
-rw-r--r--internal/builder/posts.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/builder/posts.go b/internal/builder/posts.go
index 223531b..a4526e4 100644
--- a/internal/builder/posts.go
+++ b/internal/builder/posts.go
@@ -52,13 +52,17 @@ var markdown = goldmark.New(
 func getPost(filename string) (*PostMatter, []byte, error) {
 	matter := PostMatter{}
 	content, err := os.Open(filename)
-	defer content.Close()
 	if err != nil {
 		return nil, nil, errors.WithMessagef(err, "could not open post %s", filename)
 	}
+	defer content.Close()
 	rest, err := frontmatter.MustParse(content, &matter)
 	if err != nil {
-		return nil, nil, errors.WithMessagef(err, "could not parse front matter of post %s", filename)
+		return nil, nil, errors.WithMessagef(
+			err,
+			"could not parse front matter of post %s",
+			filename,
+		)
 	}
 
 	return &matter, rest, nil