summaryrefslogtreecommitdiff
path: root/internal/db
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-04-02 15:40:09 +0200
committerLibravatar GitHub <noreply@github.com>2022-04-02 15:40:09 +0200
commit03d7c75ebf1b81b12ec21f95eef1c07b265ff939 (patch)
tree511724f53946563a3b7ba1307d25f5bda98ac3a8 /internal/db
parent[documentation] Add third-party packaging to documentation (#443) (diff)
downloadgotosocial-03d7c75ebf1b81b12ec21f95eef1c07b265ff939.tar.xz
[chore] Update Go version to 1.18 (#444)
* linting with new golangci-lint version * update go to 1.18 * bump versions in drone.yml * use new runtime/debug package for version info * remove Commit build flag from goreleaser * remove mock commit + version from build script * go fmt * add dummy version env flag to test container * install git in golang container for testing * only set versionString if Version is defined
Diffstat (limited to 'internal/db')
-rw-r--r--internal/db/bundb/mention.go8
-rw-r--r--internal/db/bundb/notification.go8
2 files changed, 14 insertions, 2 deletions
diff --git a/internal/db/bundb/mention.go b/internal/db/bundb/mention.go
index a93a5cef6..1c1c25c4b 100644
--- a/internal/db/bundb/mention.go
+++ b/internal/db/bundb/mention.go
@@ -46,7 +46,13 @@ func (m *mentionDB) getMentionCached(id string) (*gtsmodel.Mention, bool) {
if !ok {
return nil, false
}
- return v.(*gtsmodel.Mention), true
+
+ mention, ok := v.(*gtsmodel.Mention)
+ if !ok {
+ panic("mention cache entry was not a mention")
+ }
+
+ return mention, true
}
func (m *mentionDB) putMentionCache(mention *gtsmodel.Mention) {
diff --git a/internal/db/bundb/notification.go b/internal/db/bundb/notification.go
index e030cc623..d01bb9067 100644
--- a/internal/db/bundb/notification.go
+++ b/internal/db/bundb/notification.go
@@ -114,7 +114,13 @@ func (n *notificationDB) getNotificationCache(id string) (*gtsmodel.Notification
if !ok {
return nil, false
}
- return v.(*gtsmodel.Notification), true
+
+ notif, ok := v.(*gtsmodel.Notification)
+ if !ok {
+ panic("notification cache entry was not a notification")
+ }
+
+ return notif, true
}
func (n *notificationDB) putNotificationCache(notif *gtsmodel.Notification) {