diff --git a/plugin/httpgetter/image.go b/plugin/httpgetter/image.go index 2d6a163..536afea 100644 --- a/plugin/httpgetter/image.go +++ b/plugin/httpgetter/image.go @@ -29,7 +29,7 @@ func GetImage(urlStr string) (*Image, error) { return nil, err } if !strings.HasPrefix(mediatype, "image/") { - return nil, errors.New("Wrong image mediatype") + return nil, errors.New("wrong image mediatype") } bodyBytes, err := io.ReadAll(response.Body) diff --git a/server/common/version.go b/server/common/version.go index 23c01bb..d8ac471 100644 --- a/server/common/version.go +++ b/server/common/version.go @@ -34,7 +34,7 @@ func GetSchemaVersion(version string) string { return minorVersion + ".0" } -// IsVersionGreaterThanOrEqualTo returns true if version is greater than or equal to target. +// IsVersionGreaterOrEqualThan returns true if version is greater than or equal to target. func IsVersionGreaterOrEqualThan(version, target string) bool { return semver.Compare(fmt.Sprintf("v%s", version), fmt.Sprintf("v%s", target)) > -1 } diff --git a/store/shortcut.go b/store/shortcut.go index 61049ff..bad4e76 100644 --- a/store/shortcut.go +++ b/store/shortcut.go @@ -62,7 +62,9 @@ func (s *Store) ListShortcuts(ctx context.Context, find *FindShortcut) ([]*store func (s *Store) GetShortcut(ctx context.Context, find *FindShortcut) (*storepb.Shortcut, error) { if find.ID != nil { if cache, ok := s.shortcutCache.Load(*find.ID); ok { - return cache.(*storepb.Shortcut), nil + if shortcut, ok := cache.(*storepb.Shortcut); ok { + return shortcut, nil + } } } diff --git a/store/user.go b/store/user.go index adc57f7..a5139b7 100644 --- a/store/user.go +++ b/store/user.go @@ -85,7 +85,9 @@ func (s *Store) ListUsers(ctx context.Context, find *FindUser) ([]*User, error) func (s *Store) GetUser(ctx context.Context, find *FindUser) (*User, error) { if find.ID != nil { if cache, ok := s.userCache.Load(*find.ID); ok { - return cache.(*User), nil + if user, ok := cache.(*User); ok { + return user, nil + } } } diff --git a/store/user_setting.go b/store/user_setting.go index 9c9783a..bb1ad6a 100644 --- a/store/user_setting.go +++ b/store/user_setting.go @@ -35,7 +35,9 @@ func (s *Store) ListUserSettings(ctx context.Context, find *FindUserSetting) ([] func (s *Store) GetUserSetting(ctx context.Context, find *FindUserSetting) (*storepb.UserSetting, error) { if find.UserID != nil && find.Key != storepb.UserSettingKey_USER_SETTING_KEY_UNSPECIFIED { if cache, ok := s.userSettingCache.Load(getUserSettingCacheKey(*find.UserID, find.Key.String())); ok { - return cache.(*storepb.UserSetting), nil + if userSetting, ok := cache.(*storepb.UserSetting); ok { + return userSetting, nil + } } } diff --git a/store/workspace_setting.go b/store/workspace_setting.go index 9b1249f..98386a5 100644 --- a/store/workspace_setting.go +++ b/store/workspace_setting.go @@ -35,7 +35,9 @@ func (s *Store) ListWorkspaceSettings(ctx context.Context, find *FindWorkspaceSe func (s *Store) GetWorkspaceSetting(ctx context.Context, find *FindWorkspaceSetting) (*storepb.WorkspaceSetting, error) { if find.Key != storepb.WorkspaceSettingKey_WORKSPACE_SETTING_KEY_UNSPECIFIED { if cache, ok := s.workspaceSettingCache.Load(find.Key); ok { - return cache.(*storepb.WorkspaceSetting), nil + if workspaceSetting, ok := cache.(*storepb.WorkspaceSetting); ok { + return workspaceSetting, nil + } } } diff --git a/test/store/collection_test.go b/test/store/collection_test.go index 7607bcf..9914b27 100644 --- a/test/store/collection_test.go +++ b/test/store/collection_test.go @@ -31,15 +31,15 @@ func TestCollectionStore(t *testing.T) { require.Equal(t, 1, len(collections)) require.Equal(t, collection, collections[0]) newTitle := "My new collection" - newShortcutIds := []int32{101, 103} + newShortcutIDs := []int32{101, 103} updatedCollection, err := ts.UpdateCollection(ctx, &store.UpdateCollection{ ID: collection.Id, Title: &newTitle, - ShortcutIDs: newShortcutIds, + ShortcutIDs: newShortcutIDs, }) require.NoError(t, err) require.Equal(t, newTitle, updatedCollection.Title) - require.Equal(t, newShortcutIds, updatedCollection.ShortcutIds) + require.Equal(t, newShortcutIDs, updatedCollection.ShortcutIds) err = ts.DeleteCollection(ctx, &store.DeleteCollection{ ID: collection.Id, })