From 03d7c75ebf1b81b12ec21f95eef1c07b265ff939 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Sat, 2 Apr 2022 15:40:09 +0200 Subject: [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 --- internal/cache/account.go | 8 +++++++- internal/cache/status.go | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'internal/cache') diff --git a/internal/cache/account.go b/internal/cache/account.go index 98f1684a4..02ec71503 100644 --- a/internal/cache/account.go +++ b/internal/cache/account.go @@ -91,7 +91,13 @@ func (c *AccountCache) getByID(id string) (*gtsmodel.Account, bool) { if !ok { return nil, false } - return copyAccount(v.(*gtsmodel.Account)), true + + a, ok := v.(*gtsmodel.Account) + if !ok { + panic("account cache entry was not an account") + } + + return copyAccount(a), true } // Put places a account in the cache, ensuring that the object place is a copy for thread-safety diff --git a/internal/cache/status.go b/internal/cache/status.go index 1e92c9c63..9a698c608 100644 --- a/internal/cache/status.go +++ b/internal/cache/status.go @@ -91,7 +91,13 @@ func (c *StatusCache) getByID(id string) (*gtsmodel.Status, bool) { if !ok { return nil, false } - return copyStatus(v.(*gtsmodel.Status)), true + + s, ok := v.(*gtsmodel.Status) + if !ok { + panic("status cache entry was not a status") + } + + return copyStatus(s), true } // Put places a status in the cache, ensuring that the object place is a copy for thread-safety -- cgit v1.2.3