Fix lint errors in modified code (#1966)

* makelint /internal 0228

Signed-off-by: xuan <146319162+wxuanF@users.noreply.github.com>

* Update server.go

---------

Signed-off-by: xuan <146319162+wxuanF@users.noreply.github.com>
pull/1967/head
xuan 9 months ago committed by GitHub
parent 613bacb789
commit bcc6a95633
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -19,8 +19,9 @@ import (
) )
type Consumer struct { type Consumer struct {
pushCh ConsumerHandler pushCh ConsumerHandler
successCount uint64 // successCount is unused
// successCount uint64
} }
func NewConsumer(pusher *Pusher) (*Consumer, error) { func NewConsumer(pusher *Pusher) (*Consumer, error) {

@ -28,7 +28,7 @@ import (
) )
func (s *friendServer) GetPaginationBlacks(ctx context.Context, req *pbfriend.GetPaginationBlacksReq) (resp *pbfriend.GetPaginationBlacksResp, err error) { func (s *friendServer) GetPaginationBlacks(ctx context.Context, req *pbfriend.GetPaginationBlacksReq) (resp *pbfriend.GetPaginationBlacksResp, err error) {
if err := s.userRpcClient.Access(ctx, req.UserID); err != nil { if accessErr := s.userRpcClient.Access(ctx, req.UserID); accessErr != nil {
return nil, err return nil, err
} }
total, blacks, err := s.blackDatabase.FindOwnerBlacks(ctx, req.UserID, req.Pagination) total, blacks, err := s.blackDatabase.FindOwnerBlacks(ctx, req.UserID, req.Pagination)

@ -115,7 +115,7 @@ func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error {
func (s *friendServer) ApplyToAddFriend(ctx context.Context, req *pbfriend.ApplyToAddFriendReq) (resp *pbfriend.ApplyToAddFriendResp, err error) { func (s *friendServer) ApplyToAddFriend(ctx context.Context, req *pbfriend.ApplyToAddFriendReq) (resp *pbfriend.ApplyToAddFriendResp, err error) {
defer log.ZInfo(ctx, utils.GetFuncName()+" Return") defer log.ZInfo(ctx, utils.GetFuncName()+" Return")
resp = &pbfriend.ApplyToAddFriendResp{} resp = &pbfriend.ApplyToAddFriendResp{}
if err := authverify.CheckAccessV3(ctx, req.FromUserID); err != nil { if accessErr := authverify.CheckAccessV3(ctx, req.FromUserID); accessErr != nil {
return nil, err return nil, err
} }
if req.ToUserID == req.FromUserID { if req.ToUserID == req.FromUserID {
@ -124,7 +124,7 @@ func (s *friendServer) ApplyToAddFriend(ctx context.Context, req *pbfriend.Apply
if err = CallbackBeforeAddFriend(ctx, req); err != nil && err != errs.ErrCallbackContinue { if err = CallbackBeforeAddFriend(ctx, req); err != nil && err != errs.ErrCallbackContinue {
return nil, err return nil, err
} }
if _, err := s.userRpcClient.GetUsersInfoMap(ctx, []string{req.ToUserID, req.FromUserID}); err != nil { if _, getUserInfoErr := s.userRpcClient.GetUsersInfoMap(ctx, []string{req.ToUserID, req.FromUserID}); getUserInfoErr != nil {
return nil, err return nil, err
} }
in1, in2, err := s.friendDatabase.CheckIn(ctx, req.FromUserID, req.ToUserID) in1, in2, err := s.friendDatabase.CheckIn(ctx, req.FromUserID, req.ToUserID)
@ -219,7 +219,7 @@ func (s *friendServer) RespondFriendApply(ctx context.Context, req *pbfriend.Res
func (s *friendServer) DeleteFriend(ctx context.Context, req *pbfriend.DeleteFriendReq) (resp *pbfriend.DeleteFriendResp, err error) { func (s *friendServer) DeleteFriend(ctx context.Context, req *pbfriend.DeleteFriendReq) (resp *pbfriend.DeleteFriendResp, err error) {
defer log.ZInfo(ctx, utils.GetFuncName()+" Return") defer log.ZInfo(ctx, utils.GetFuncName()+" Return")
resp = &pbfriend.DeleteFriendResp{} resp = &pbfriend.DeleteFriendResp{}
if err := s.userRpcClient.Access(ctx, req.OwnerUserID); err != nil { if accessErr := s.userRpcClient.Access(ctx, req.OwnerUserID); accessErr != nil {
return nil, err return nil, err
} }
_, err = s.friendDatabase.FindFriendsWithError(ctx, req.OwnerUserID, []string{req.FriendUserID}) _, err = s.friendDatabase.FindFriendsWithError(ctx, req.OwnerUserID, []string{req.FriendUserID})
@ -244,7 +244,7 @@ func (s *friendServer) SetFriendRemark(ctx context.Context, req *pbfriend.SetFri
return nil, err return nil, err
} }
resp = &pbfriend.SetFriendRemarkResp{} resp = &pbfriend.SetFriendRemarkResp{}
if err := s.userRpcClient.Access(ctx, req.OwnerUserID); err != nil { if accessErr := s.userRpcClient.Access(ctx, req.OwnerUserID); accessErr != nil {
return nil, err return nil, err
} }
_, err = s.friendDatabase.FindFriendsWithError(ctx, req.OwnerUserID, []string{req.FriendUserID}) _, err = s.friendDatabase.FindFriendsWithError(ctx, req.OwnerUserID, []string{req.FriendUserID})
@ -295,7 +295,7 @@ func (s *friendServer) GetDesignatedFriendsApply(ctx context.Context,
// ok 获取接收到的好友申请(即别人主动申请的). // ok 获取接收到的好友申请(即别人主动申请的).
func (s *friendServer) GetPaginationFriendsApplyTo(ctx context.Context, req *pbfriend.GetPaginationFriendsApplyToReq) (resp *pbfriend.GetPaginationFriendsApplyToResp, err error) { func (s *friendServer) GetPaginationFriendsApplyTo(ctx context.Context, req *pbfriend.GetPaginationFriendsApplyToReq) (resp *pbfriend.GetPaginationFriendsApplyToResp, err error) {
defer log.ZInfo(ctx, utils.GetFuncName()+" Return") defer log.ZInfo(ctx, utils.GetFuncName()+" Return")
if err := s.userRpcClient.Access(ctx, req.UserID); err != nil { if accessErr := s.userRpcClient.Access(ctx, req.UserID); accessErr != nil {
return nil, err return nil, err
} }
total, friendRequests, err := s.friendDatabase.PageFriendRequestToMe(ctx, req.UserID, req.Pagination) total, friendRequests, err := s.friendDatabase.PageFriendRequestToMe(ctx, req.UserID, req.Pagination)
@ -315,7 +315,7 @@ func (s *friendServer) GetPaginationFriendsApplyTo(ctx context.Context, req *pbf
func (s *friendServer) GetPaginationFriendsApplyFrom(ctx context.Context, req *pbfriend.GetPaginationFriendsApplyFromReq) (resp *pbfriend.GetPaginationFriendsApplyFromResp, err error) { func (s *friendServer) GetPaginationFriendsApplyFrom(ctx context.Context, req *pbfriend.GetPaginationFriendsApplyFromReq) (resp *pbfriend.GetPaginationFriendsApplyFromResp, err error) {
defer log.ZInfo(ctx, utils.GetFuncName()+" Return") defer log.ZInfo(ctx, utils.GetFuncName()+" Return")
resp = &pbfriend.GetPaginationFriendsApplyFromResp{} resp = &pbfriend.GetPaginationFriendsApplyFromResp{}
if err := s.userRpcClient.Access(ctx, req.UserID); err != nil { if accessErr := s.userRpcClient.Access(ctx, req.UserID); accessErr != nil {
return nil, err return nil, err
} }
total, friendRequests, err := s.friendDatabase.PageFriendRequestFromMe(ctx, req.UserID, req.Pagination) total, friendRequests, err := s.friendDatabase.PageFriendRequestFromMe(ctx, req.UserID, req.Pagination)
@ -343,7 +343,7 @@ func (s *friendServer) IsFriend(ctx context.Context, req *pbfriend.IsFriendReq)
func (s *friendServer) GetPaginationFriends(ctx context.Context, req *pbfriend.GetPaginationFriendsReq) (resp *pbfriend.GetPaginationFriendsResp, err error) { func (s *friendServer) GetPaginationFriends(ctx context.Context, req *pbfriend.GetPaginationFriendsReq) (resp *pbfriend.GetPaginationFriendsResp, err error) {
defer log.ZInfo(ctx, utils.GetFuncName()+" Return") defer log.ZInfo(ctx, utils.GetFuncName()+" Return")
if err := s.userRpcClient.Access(ctx, req.UserID); err != nil { if accessErr := s.userRpcClient.Access(ctx, req.UserID); accessErr != nil {
return nil, err return nil, err
} }
total, friends, err := s.friendDatabase.PageOwnerFriends(ctx, req.UserID, req.Pagination) total, friends, err := s.friendDatabase.PageOwnerFriends(ctx, req.UserID, req.Pagination)
@ -361,7 +361,7 @@ func (s *friendServer) GetPaginationFriends(ctx context.Context, req *pbfriend.G
func (s *friendServer) GetFriendIDs(ctx context.Context, req *pbfriend.GetFriendIDsReq) (resp *pbfriend.GetFriendIDsResp, err error) { func (s *friendServer) GetFriendIDs(ctx context.Context, req *pbfriend.GetFriendIDsReq) (resp *pbfriend.GetFriendIDsResp, err error) {
defer log.ZInfo(ctx, utils.GetFuncName()+" Return") defer log.ZInfo(ctx, utils.GetFuncName()+" Return")
if err := s.userRpcClient.Access(ctx, req.UserID); err != nil { if accessErr := s.userRpcClient.Access(ctx, req.UserID); accessErr != nil {
return nil, err return nil, err
} }
resp = &pbfriend.GetFriendIDsResp{} resp = &pbfriend.GetFriendIDsResp{}

@ -539,7 +539,7 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbgroup.KickGrou
if err != nil { if err != nil {
return nil, err return nil, err
} }
if err := s.PopulateGroupMember(ctx, members...); err != nil { if populateErr := s.PopulateGroupMember(ctx, members...); populateErr != nil {
return nil, err return nil, err
} }
memberMap := make(map[string]*relationtb.GroupMemberModel) memberMap := make(map[string]*relationtb.GroupMemberModel)
@ -765,12 +765,12 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbgroup
return nil, errs.ErrGroupRequestHandled.Wrap("group request already processed") return nil, errs.ErrGroupRequestHandled.Wrap("group request already processed")
} }
var inGroup bool var inGroup bool
if _, err := s.db.TakeGroupMember(ctx, req.GroupID, req.FromUserID); err == nil { if _, takeErr := s.db.TakeGroupMember(ctx, req.GroupID, req.FromUserID); takeErr == nil {
inGroup = true // 已经在群里了 inGroup = true // 已经在群里了
} else if !s.IsNotFound(err) { } else if !s.IsNotFound(err) {
return nil, err return nil, err
} }
if _, err := s.User.GetPublicUserInfo(ctx, req.FromUserID); err != nil { if _, getInfoErr := s.User.GetPublicUserInfo(ctx, req.FromUserID); getInfoErr != nil {
return nil, err return nil, err
} }
var member *relationtb.GroupMemberModel var member *relationtb.GroupMemberModel
@ -857,14 +857,14 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbgroup.JoinGroupReq)
JoinTime: time.Now(), JoinTime: time.Now(),
MuteEndTime: time.UnixMilli(0), MuteEndTime: time.UnixMilli(0),
} }
if err := CallbackBeforeMemberJoinGroup(ctx, groupMember, group.Ex); err != nil { if callbackErr := CallbackBeforeMemberJoinGroup(ctx, groupMember, group.Ex); callbackErr != nil {
return nil, err return nil, err
} }
if err := s.db.CreateGroup(ctx, nil, []*relationtb.GroupMemberModel{groupMember}); err != nil { if createErr := s.db.CreateGroup(ctx, nil, []*relationtb.GroupMemberModel{groupMember}); createErr != nil {
return nil, err return nil, err
} }
if err := s.conversationRpcClient.GroupChatFirstCreateConversation(ctx, req.GroupID, []string{req.InviterUserID}); err != nil { if createErr := s.conversationRpcClient.GroupChatFirstCreateConversation(ctx, req.GroupID, []string{req.InviterUserID}); createErr != nil {
return nil, err return nil, err
} }
s.Notification.MemberEnterNotification(ctx, req.GroupID, req.InviterUserID) s.Notification.MemberEnterNotification(ctx, req.GroupID, req.InviterUserID)
@ -905,7 +905,7 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbgroup.QuitGroupReq)
if member.RoleLevel == constant.GroupOwner { if member.RoleLevel == constant.GroupOwner {
return nil, errs.ErrNoPermission.Wrap("group owner can't quit") return nil, errs.ErrNoPermission.Wrap("group owner can't quit")
} }
if err := s.PopulateGroupMember(ctx, member); err != nil { if populateErr := s.PopulateGroupMember(ctx, member); populateErr != nil {
return nil, err return nil, err
} }
err = s.db.DeleteGroupMember(ctx, req.GroupID, []string{req.UserID}) err = s.db.DeleteGroupMember(ctx, req.GroupID, []string{req.UserID})
@ -967,14 +967,14 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbgroup.SetGroupInf
if err != nil { if err != nil {
return nil, err return nil, err
} }
if err := s.PopulateGroupMember(ctx, owner); err != nil { if populateErr := s.PopulateGroupMember(ctx, owner); populateErr != nil {
return nil, err return nil, err
} }
update := UpdateGroupInfoMap(ctx, req.GroupInfoForSet) update := UpdateGroupInfoMap(ctx, req.GroupInfoForSet)
if len(update) == 0 { if len(update) == 0 {
return resp, nil return resp, nil
} }
if err := s.db.UpdateGroup(ctx, group.GroupID, update); err != nil { if updateErr := s.db.UpdateGroup(ctx, group.GroupID, update); updateErr != nil {
return nil, err return nil, err
} }
group, err = s.db.TakeGroup(ctx, req.GroupInfoForSet.GroupID) group, err = s.db.TakeGroup(ctx, req.GroupInfoForSet.GroupID)
@ -1168,7 +1168,7 @@ func (s *groupServer) GetUserReqApplicationList(ctx context.Context, req *pbgrou
if err != nil { if err != nil {
return nil, err return nil, err
} }
if err := s.PopulateGroupMember(ctx, owners...); err != nil { if populateErr := s.PopulateGroupMember(ctx, owners...); populateErr != nil {
return nil, err return nil, err
} }
ownerMap := utils.SliceToMap(owners, func(e *relationtb.GroupMemberModel) string { ownerMap := utils.SliceToMap(owners, func(e *relationtb.GroupMemberModel) string {
@ -1200,17 +1200,17 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbgroup.DismissGrou
return nil, errs.ErrNoPermission.Wrap("not group owner") return nil, errs.ErrNoPermission.Wrap("not group owner")
} }
} }
if err := s.PopulateGroupMember(ctx, owner); err != nil { if populateErr := s.PopulateGroupMember(ctx, owner); populateErr != nil {
return nil, err return nil, err
} }
group, err := s.db.TakeGroup(ctx, req.GroupID) group, err := s.db.TakeGroup(ctx, req.GroupID)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if req.DeleteMember == false && group.Status == constant.GroupStatusDismissed { if !req.DeleteMember && group.Status == constant.GroupStatusDismissed {
return nil, errs.ErrDismissedAlready.Wrap("group status is dismissed") return nil, errs.ErrDismissedAlready.Wrap("group status is dismissed")
} }
if err := s.db.DismissGroup(ctx, req.GroupID, req.DeleteMember); err != nil { if dismissErr := s.db.DismissGroup(ctx, req.GroupID, req.DeleteMember); dismissErr != nil {
return nil, err return nil, err
} }
if !req.DeleteMember { if !req.DeleteMember {
@ -1566,7 +1566,7 @@ func (s *groupServer) GetGroupUsersReqApplicationList(ctx context.Context, req *
if err != nil { if err != nil {
return nil, err return nil, err
} }
if err := s.PopulateGroupMember(ctx, owners...); err != nil { if populateErr := s.PopulateGroupMember(ctx, owners...); populateErr != nil {
return nil, err return nil, err
} }
ownerMap := utils.SliceToMap(owners, func(e *relationtb.GroupMemberModel) string { ownerMap := utils.SliceToMap(owners, func(e *relationtb.GroupMemberModel) string {

@ -82,7 +82,7 @@ func (m *msgServer) SetConversationHasReadSeq(
if req.HasReadSeq > maxSeq { if req.HasReadSeq > maxSeq {
return nil, errs.ErrArgs.Wrap("hasReadSeq must not be bigger than maxSeq") return nil, errs.ErrArgs.Wrap("hasReadSeq must not be bigger than maxSeq")
} }
if err := m.MsgDatabase.SetHasReadSeq(ctx, req.UserID, req.ConversationID, req.HasReadSeq); err != nil { if setErr := m.MsgDatabase.SetHasReadSeq(ctx, req.UserID, req.ConversationID, req.HasReadSeq); setErr != nil {
return nil, err return nil, err
} }
if err = m.sendMarkAsReadNotification(ctx, req.ConversationID, constant.SingleChatType, req.UserID, if err = m.sendMarkAsReadNotification(ctx, req.ConversationID, constant.SingleChatType, req.UserID,

@ -68,7 +68,7 @@ func (m *msgServer) RevokeMsg(ctx context.Context, req *msg.RevokeMsgReq) (*msg.
if !authverify.IsAppManagerUid(ctx) { if !authverify.IsAppManagerUid(ctx) {
switch msgs[0].SessionType { switch msgs[0].SessionType {
case constant.SingleChatType: case constant.SingleChatType:
if err := authverify.CheckAccessV3(ctx, msgs[0].SendID); err != nil { if accessErr := authverify.CheckAccessV3(ctx, msgs[0].SendID); accessErr != nil {
return nil, err return nil, err
} }
role = user.AppMangerLevel role = user.AppMangerLevel
@ -133,7 +133,7 @@ func (m *msgServer) RevokeMsg(ctx context.Context, req *msg.RevokeMsgReq) (*msg.
} else { } else {
recvID = msgs[0].RecvID recvID = msgs[0].RecvID
} }
if err := m.notificationSender.NotificationWithSesstionType(ctx, req.UserID, recvID, constant.MsgRevokeNotification, msgs[0].SessionType, &tips); err != nil { if notificationErr := m.notificationSender.NotificationWithSesstionType(ctx, req.UserID, recvID, constant.MsgRevokeNotification, msgs[0].SessionType, &tips); notificationErr != nil {
return nil, err return nil, err
} }
if err = CallbackAfterRevokeMsg(ctx, req); err != nil { if err = CallbackAfterRevokeMsg(ctx, req); err != nil {

@ -66,7 +66,7 @@ func (m *msgServer) sendMsgSuperGroupChat(
return nil, err return nil, err
} }
if err := callbackMsgModify(ctx, req); err != nil { if modifyErr := callbackMsgModify(ctx, req); modifyErr != nil {
return nil, err return nil, err
} }
err = m.MsgDatabase.MsgToMQ(ctx, utils.GenConversationUniqueKeyForGroup(req.MsgData.GroupID), req.MsgData) err = m.MsgDatabase.MsgToMQ(ctx, utils.GenConversationUniqueKeyForGroup(req.MsgData.GroupID), req.MsgData)
@ -144,7 +144,7 @@ func (m *msgServer) sendMsgNotification(
} }
func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *pbmsg.SendMsgReq) (resp *pbmsg.SendMsgResp, err error) { func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *pbmsg.SendMsgReq) (resp *pbmsg.SendMsgResp, err error) {
if err := m.messageVerification(ctx, req); err != nil { if verificationErr := m.messageVerification(ctx, req); verificationErr != nil {
return nil, err return nil, err
} }
isSend := true isSend := true
@ -169,10 +169,10 @@ func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *pbmsg.SendMsgReq
return nil, err return nil, err
} }
if err := callbackMsgModify(ctx, req); err != nil { if modifyErr := callbackMsgModify(ctx, req); modifyErr != nil {
return nil, err return nil, err
} }
if err := m.MsgDatabase.MsgToMQ(ctx, utils.GenConversationUniqueKeyForSingle(req.MsgData.SendID, req.MsgData.RecvID), req.MsgData); err != nil { if mqErr := m.MsgDatabase.MsgToMQ(ctx, utils.GenConversationUniqueKeyForSingle(req.MsgData.SendID, req.MsgData.RecvID), req.MsgData); mqErr != nil {
prommetrics.SingleChatMsgProcessFailedCounter.Inc() prommetrics.SingleChatMsgProcessFailedCounter.Inc()
return nil, err return nil, err
} }

@ -15,7 +15,6 @@
package msg package msg
import ( import (
"context"
"google.golang.org/grpc" "google.golang.org/grpc"
@ -51,16 +50,17 @@ func (m *msgServer) addInterceptorHandler(interceptorFunc ...MessageInterceptorF
m.Handlers = append(m.Handlers, interceptorFunc...) m.Handlers = append(m.Handlers, interceptorFunc...)
} }
func (m *msgServer) execInterceptorHandler(ctx context.Context, req *msg.SendMsgReq) error { // func `(*msgServer).execInterceptorHandler` is unused
for _, handler := range m.Handlers { // func (m *msgServer) execInterceptorHandler(ctx context.Context, req *msg.SendMsgReq) error {
msgData, err := handler(ctx, req) // for _, handler := range m.Handlers {
if err != nil { // msgData, err := handler(ctx, req)
return err // if err != nil {
} // return err
req.MsgData = msgData // }
} // req.MsgData = msgData
return nil // }
} // return nil
// }
func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error { func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
rdb, err := cache.NewRedis() rdb, err := cache.NewRedis()
@ -71,7 +71,7 @@ func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) e
if err != nil { if err != nil {
return err return err
} }
if err := mongo.CreateMsgIndex(); err != nil { if indexErr := mongo.CreateMsgIndex(); indexErr != nil {
return err return err
} }
cacheModel := cache.NewMsgCacheModel(rdb) cacheModel := cache.NewMsgCacheModel(rdb)

@ -75,7 +75,7 @@ func (t *thirdServer) InitiateMultipartUpload(ctx context.Context, req *third.In
Group: req.Cause, Group: req.Cause,
CreateTime: time.Now(), CreateTime: time.Now(),
} }
if err := t.s3dataBase.SetObject(ctx, obj); err != nil { if setObjectErr := t.s3dataBase.SetObject(ctx, obj); setObjectErr != nil {
return nil, err return nil, err
} }
return &third.InitiateMultipartUploadResp{ return &third.InitiateMultipartUploadResp{
@ -257,10 +257,10 @@ func (t *thirdServer) CompleteFormData(ctx context.Context, req *third.CompleteF
return nil, errs.ErrArgs.Wrap("invalid id " + err.Error()) return nil, errs.ErrArgs.Wrap("invalid id " + err.Error())
} }
var mate FormDataMate var mate FormDataMate
if err := json.Unmarshal(data, &mate); err != nil { if unmarshalErr := json.Unmarshal(data, &mate); unmarshalErr != nil {
return nil, errs.ErrArgs.Wrap("invalid id " + err.Error()) return nil, errs.ErrArgs.Wrap("invalid id " + err.Error())
} }
if err := checkUploadName(ctx, mate.Name); err != nil { if uploadErr := checkUploadName(ctx, mate.Name); uploadErr != nil {
return nil, err return nil, err
} }
info, err := t.s3dataBase.StatObject(ctx, mate.Key) info, err := t.s3dataBase.StatObject(ctx, mate.Key)

@ -56,7 +56,7 @@ func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) e
if apiURL == "" { if apiURL == "" {
return fmt.Errorf("api url is empty") return fmt.Errorf("api url is empty")
} }
if _, err := url.Parse(config.Config.Object.ApiURL); err != nil { if _, parseErr := url.Parse(config.Config.Object.ApiURL); parseErr != nil {
return err return err
} }
if apiURL[len(apiURL)-1] != '/' { if apiURL[len(apiURL)-1] != '/' {

@ -123,11 +123,11 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbuser.UpdateUserI
if err != nil { if err != nil {
return nil, err return nil, err
} }
if err := CallbackBeforeUpdateUserInfo(ctx, req); err != nil { if callbackErr := CallbackBeforeUpdateUserInfo(ctx, req); callbackErr != nil {
return nil, err return nil, err
} }
data := convert.UserPb2DBMap(req.UserInfo) data := convert.UserPb2DBMap(req.UserInfo)
if err := s.UpdateByMap(ctx, req.UserInfo.UserID, data); err != nil { if updateErr := s.UpdateByMap(ctx, req.UserInfo.UserID, data); updateErr != nil {
return nil, err return nil, err
} }
_ = s.friendNotificationSender.UserInfoUpdatedNotification(ctx, req.UserInfo.UserID) _ = s.friendNotificationSender.UserInfoUpdatedNotification(ctx, req.UserInfo.UserID)

Loading…
Cancel
Save