fix: fix all lint warning in pkg (#1263)

* fix:fix lint errors in internal

* fix:fix lint error in interal/tools

* fix: fix lint errros  in pkg/statics

* fix: fix lint erros in pkg/authverify,pkg/rpcclien

* fix: fix lint erros in pkg/common/cmd

* fix: fix lint erros in pkg/common/config,convert

* fix: fix lint erros in pkg/common/db/cache

* fix: fix lint errors in pkg/common/db/controller

* fix:fix lint errors in pkg/common/db/relation
and pkg/common/db/localcache

* fix: fix rest lint errors in pkg/common/db

* fix: fix rest lint errors in pkg

* fix:set back go.work to use go 1.19
This commit is contained in:
CNCSMonster
2023-10-23 16:24:55 +08:00
committed by GitHub
parent ba190fde13
commit b1415473ff
91 changed files with 1617 additions and 855 deletions
+20 -13
View File
@@ -57,6 +57,7 @@ func WithDBFunc(
for _, user := range users {
result = append(result, user)
}
return result, nil
}
s.getUsersInfo = f
@@ -75,6 +76,7 @@ func WithRpcFunc(
for _, user := range users {
result = append(result, user)
}
return result, err
}
s.getUsersInfo = f
@@ -91,6 +93,7 @@ func NewFriendNotificationSender(
for _, opt := range opts {
opt(f)
}
return f
}
@@ -106,22 +109,13 @@ func (f *FriendNotificationSender) getUsersInfoMap(
for _, user := range users {
result[user.GetUserID()] = user.(*sdkws.UserInfo)
}
return result, nil
}
func (f *FriendNotificationSender) getFromToUserNickname(
ctx context.Context,
fromUserID, toUserID string,
) (string, string, error) {
users, err := f.getUsersInfoMap(ctx, []string{fromUserID, toUserID})
if err != nil {
return "", "", nil
}
return users[fromUserID].Nickname, users[toUserID].Nickname, nil
return result, nil
}
func (f *FriendNotificationSender) UserInfoUpdatedNotification(ctx context.Context, changedUserID string) error {
tips := sdkws.UserInfoUpdatedTips{UserID: changedUserID}
return f.Notification(ctx, mcontext.GetOpUserID(ctx), changedUserID, constant.UserInfoUpdatedNotification, &tips)
}
@@ -133,6 +127,7 @@ func (f *FriendNotificationSender) FriendApplicationAddNotification(
FromUserID: req.FromUserID,
ToUserID: req.ToUserID,
}}
return f.Notification(ctx, req.FromUserID, req.ToUserID, constant.FriendApplicationNotification, &tips)
}
@@ -144,6 +139,7 @@ func (f *FriendNotificationSender) FriendApplicationAgreedNotification(
FromUserID: req.FromUserID,
ToUserID: req.ToUserID,
}, HandleMsg: req.HandleMsg}
return f.Notification(ctx, req.ToUserID, req.FromUserID, constant.FriendApplicationApprovedNotification, &tips)
}
@@ -155,6 +151,7 @@ func (f *FriendNotificationSender) FriendApplicationRefusedNotification(
FromUserID: req.FromUserID,
ToUserID: req.ToUserID,
}, HandleMsg: req.HandleMsg}
return f.Notification(ctx, req.ToUserID, req.FromUserID, constant.FriendApplicationRejectedNotification, &tips)
}
@@ -179,6 +176,7 @@ func (f *FriendNotificationSender) FriendAddedNotification(
if err != nil {
return err
}
return f.Notification(ctx, fromUserID, toUserID, constant.FriendAddedNotification, &tips)
}
@@ -187,6 +185,7 @@ func (f *FriendNotificationSender) FriendDeletedNotification(ctx context.Context
FromUserID: req.OwnerUserID,
ToUserID: req.FriendUserID,
}}
return f.Notification(ctx, req.OwnerUserID, req.FriendUserID, constant.FriendDeletedNotification, &tips)
}
@@ -194,6 +193,7 @@ func (f *FriendNotificationSender) FriendRemarkSetNotification(ctx context.Conte
tips := sdkws.FriendInfoChangedTips{FromToUserID: &sdkws.FromToUserID{}}
tips.FromToUserID.FromUserID = fromUserID
tips.FromToUserID.ToUserID = toUserID
return f.Notification(ctx, fromUserID, toUserID, constant.FriendRemarkSetNotification, &tips)
}
@@ -201,6 +201,7 @@ func (f *FriendNotificationSender) BlackAddedNotification(ctx context.Context, r
tips := sdkws.BlackAddedTips{FromToUserID: &sdkws.FromToUserID{}}
tips.FromToUserID.FromUserID = req.OwnerUserID
tips.FromToUserID.ToUserID = req.BlackUserID
return f.Notification(ctx, req.OwnerUserID, req.BlackUserID, constant.BlackAddedNotification, &tips)
}
@@ -209,7 +210,10 @@ func (f *FriendNotificationSender) BlackDeletedNotification(ctx context.Context,
FromUserID: req.OwnerUserID,
ToUserID: req.BlackUserID,
}}
f.Notification(ctx, req.OwnerUserID, req.BlackUserID, constant.BlackDeletedNotification, &blackDeletedTips)
err := f.Notification(ctx, req.OwnerUserID, req.BlackUserID, constant.BlackDeletedNotification, &blackDeletedTips)
if err != nil {
panic(err)
}
}
func (f *FriendNotificationSender) FriendInfoUpdatedNotification(
@@ -218,5 +222,8 @@ func (f *FriendNotificationSender) FriendInfoUpdatedNotification(
needNotifiedUserID string,
) {
tips := sdkws.UserInfoUpdatedTips{UserID: changedUserID}
f.Notification(ctx, mcontext.GetOpUserID(ctx), needNotifiedUserID, constant.FriendInfoUpdatedNotification, &tips)
err := f.Notification(ctx, mcontext.GetOpUserID(ctx), needNotifiedUserID, constant.FriendInfoUpdatedNotification, &tips)
if err != nil {
panic(err)
}
}