about summary refs log tree commit diff stats
path: root/internal/builder/posts.go
diff options
context:
space:
mode:
authorAlan Pearce2024-05-18 20:23:27 +0200
committerAlan Pearce2024-05-18 20:23:27 +0200
commit7dc19d115c5f3b012f96284adc8cadb9b703d6db (patch)
tree663783920a624046fed7618dc1bdf1bbf389aaf3 /internal/builder/posts.go
parent9a10bbdb7ab8cb4da1002729b463ed9beca13858 (diff)
downloadwebsite-7dc19d115c5f3b012f96284adc8cadb9b703d6db.tar.lz
website-7dc19d115c5f3b012f96284adc8cadb9b703d6db.tar.zst
website-7dc19d115c5f3b012f96284adc8cadb9b703d6db.zip
remove lint errors
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