ref: 4d2d9e021317ae27fcdb6d216cde50dd9da766ac
parent: 59480f94fef08cca71c34bde5e9331d124fff595
author: fops <billgates@cock.li>
date: Fri Oct 17 14:39:07 EDT 2025
add err check, reduce use of fmt.Sprintf
--- a/main.go
+++ b/main.go
@@ -180,6 +180,9 @@
case "read":
defer hc.prompt.UpdatePrompt()
notifications, err := hc.GetUnreadNotifications()
+ if err != nil {+ fmt.Print(err)
+ }
if len(notifications) > 0 {err = hc.SetNotificationsRead(notifications[len(notifications)-1].ID)
if err != nil {--- a/mastodon.go
+++ b/mastodon.go
@@ -190,10 +190,10 @@
func (hc *Hellclient) RenderPostPlaintext(post *mastodon.Status, ref postref) (selectedPost *mastodon.Status, plaintext string) { if post.Reblog != nil {selectedPost = post.Reblog
- plaintext = fmt.Sprintf("$username Reblogged $index $boostuser $boostcontent $boosted_media_descriptions")+ plaintext = "$username Reblogged $index $boostuser $boostcontent $boosted_media_descriptions"
} else {selectedPost = post
- plaintext = fmt.Sprintf("$standard_status")+ plaintext = "$standard_status"
}
formatter := &StatusFormatter{prefs: hc.preferences, status: post, postContext: &ref}templater := newStatusTemplateRenderer(formatter)
@@ -253,7 +253,7 @@
templater := newStatusTemplateRenderer(formatter)
if hc.isPaused { hc.actionBuffer = append(hc.actionBuffer, func() {- line, _ := templater.render(fmt.Sprintf("$username EDITED: $index $content $media_descriptions\n"))+ line, _ := templater.render("$username EDITED: $index $content $media_descriptions\n")fmt.Print(line)
})
justIncrementPostref(hc.homeref, post.Status)
@@ -260,7 +260,7 @@
idmap[post.Status.ID] = post.Status
return
}
- line, _ := templater.render(fmt.Sprintf("$username EDITED: $index $content $media_descriptions\n"))+ line, _ := templater.render("$username EDITED: $index $content $media_descriptions\n")fmt.Print(line)
justIncrementPostref(hc.homeref, post.Status)
idmap[post.Status.ID] = post.Status
--- a/pages.go
+++ b/pages.go
@@ -165,9 +165,9 @@
}
var plaintext string
if formatter.status.Reblog != nil {- plaintext = fmt.Sprintf("$standard_reblog")+ plaintext = "$standard_reblog"
} else {- plaintext = fmt.Sprintf("$standard_status")+ plaintext = "$standard_status"
}
line, _ := templater.render(plaintext)
item := makePageItem(line)
--
⑨