From b0a3cbdf4f234287fa44306d6f58d9fde18b88b6 Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw)" <3293172751nss@gmail.com> Date: Tue, 19 Mar 2024 15:03:19 +0800 Subject: [PATCH] feat: add openim make lint --- .golangci.yml | 19 ++++++++++--------- internal/api/group.go | 2 +- internal/msggateway/long_conn.go | 4 ++-- .../push/offlinepush/jpush/body/audience.go | 2 +- internal/rpc/conversation/conversaion.go | 4 ++-- internal/rpc/group/group.go | 2 +- internal/rpc/msg/as_read.go | 2 +- internal/rpc/msg/send.go | 2 +- internal/rpc/msg/server.go | 2 +- internal/rpc/user/user.go | 2 +- internal/tools/conversation.go | 2 +- internal/tools/msg.go | 2 +- pkg/common/convert/group.go | 2 +- pkg/common/db/cache/conversation.go | 18 +++++++++--------- pkg/common/db/cache/friend.go | 2 +- pkg/common/db/cache/group.go | 2 +- pkg/common/db/cache/meta_cache.go | 2 +- pkg/common/db/cache/msg.go | 8 ++++---- pkg/common/db/cache/user.go | 4 ++-- pkg/common/db/mgo/conversation.go | 2 +- pkg/common/db/mgo/group_member.go | 2 +- pkg/common/db/table/relation/black.go | 2 +- pkg/common/db/table/relation/group_member.go | 8 ++++---- pkg/common/db/table/relation/user.go | 2 +- pkg/common/db/table/unrelation/super_group.go | 2 +- pkg/common/db/unrelation/super_group.go | 2 +- .../discoveryregister/zookeeper/zookeeper.go | 2 +- pkg/common/version/types.go | 2 +- pkg/rpcclient/msg.go | 2 +- pkg/rpcclient/notification/friend.go | 2 +- 30 files changed, 56 insertions(+), 55 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 63d6519ad..e0419c67c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -174,20 +174,18 @@ linters-settings: # - ^print.*$ - 'fmt\.Print.*' - fmt.Println.* # too much log noise + - painc # - ginkgo\\.F.* # these are used just for local development # # Exclude godoc examples from forbidigo checks. Default is true. # exclude_godoc_examples: false funlen: - lines: 150 + lines: 220 statements: 80 - gci: - # put imports beginning with prefix after 3rd-party packages; - # only support one prefix - # if not set, use goimports.local-prefixes - prefix: github.com/openimsdk/open-im-server + gocognit: # minimal code complexity to report, 30 by default (but we recommend 10-20) min-complexity: 30 + goconst: # minimal length of string constant, 3 by default min-len: 3 @@ -213,9 +211,6 @@ linters-settings: # By default list of stable checks is used. enabled-checks: #- rangeValCopy - - nestingreduce - - truncatecmp - - unnamedresult - ruleguard # Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty @@ -286,6 +281,9 @@ linters-settings: exclude: # example: exclude comments which contain numbers - '[0-9]+' + - 'func\s+\w+' + - 'FIXME:' + - '.*func.*' # check that each sentence starts with a capital letter capital: true godox: @@ -364,6 +362,7 @@ linters-settings: retract-allow-no-explanation: false # Forbid the use of the `exclude` directives. Default is false. exclude-forbidden: false + gomodguard: allowed: modules: @@ -740,8 +739,10 @@ linters: - dupword - errname - gci + - gocritic - goprintffuncname - gomnd + - goconst - gosec - misspell # Spelling mistakes - staticcheck # Static analysis diff --git a/internal/api/group.go b/internal/api/group.go index c18ded64b..14e6274ef 100644 --- a/internal/api/group.go +++ b/internal/api/group.go @@ -115,7 +115,7 @@ func (o *GroupApi) GetGroupAbstractInfo(c *gin.Context) { a2r.Call(group.GroupClient.GetGroupAbstractInfo, o.Client, c) } -//func (g *Group) SetGroupMemberNickname(c *gin.Context) { +// func (g *Group) SetGroupMemberNickname(c *gin.Context) { // a2r.Call(group.GroupClient.SetGroupMemberNickname, g.userClient, c) //} // diff --git a/internal/msggateway/long_conn.go b/internal/msggateway/long_conn.go index 9c21c3dd4..152bdbc6c 100644 --- a/internal/msggateway/long_conn.go +++ b/internal/msggateway/long_conn.go @@ -86,7 +86,7 @@ func (d *GWebSocket) WriteMessage(messageType int, message []byte) error { return d.conn.WriteMessage(messageType, message) } -//func (d *GWebSocket) setSendConn(sendConn *websocket.Conn) { +// func (d *GWebSocket) setSendConn(sendConn *websocket.Conn) { // d.sendConn = sendConn //} @@ -145,6 +145,6 @@ func (d *GWebSocket) SetPingHandler(handler PingPongHandler) { d.conn.SetPingHandler(handler) } -//func (d *GWebSocket) CheckSendConnDiffNow() bool { +// func (d *GWebSocket) CheckSendConnDiffNow() bool { // return d.conn == d.sendConn //} diff --git a/internal/push/offlinepush/jpush/body/audience.go b/internal/push/offlinepush/jpush/body/audience.go index 43a7148b8..86e9f08d3 100644 --- a/internal/push/offlinepush/jpush/body/audience.go +++ b/internal/push/offlinepush/jpush/body/audience.go @@ -32,7 +32,7 @@ func (a *Audience) set(key string, v []string) { a.audience = make(map[string][]string) a.Object = a.audience } - //v, ok = this.audience[key] + // v, ok = this.audience[key] //if ok { // return //} diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index a02d74f15..016cea543 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -314,7 +314,7 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver // Get user IDs with "Do Not Disturb" enabled in super large groups. func (c *conversationServer) GetRecvMsgNotNotifyUserIDs(ctx context.Context, req *pbconversation.GetRecvMsgNotNotifyUserIDsReq) (*pbconversation.GetRecvMsgNotNotifyUserIDsResp, error) { - //userIDs, err := c.conversationDatabase.FindRecvMsgNotNotifyUserIDs(ctx, req.GroupID) + // userIDs, err := c.conversationDatabase.FindRecvMsgNotNotifyUserIDs(ctx, req.GroupID) //if err != nil { // return nil, err //} @@ -433,7 +433,7 @@ func (c *conversationServer) conversationSort(conversations map[int64]string, re keys = append(keys, key) } - sort.Slice(keys[:], func(i, j int) bool { + sort.Slice(keys, func(i, j int) bool { return keys[i] > keys[j] }) index := 0 diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 0ce4b1b4f..fc5cafd76 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -107,7 +107,7 @@ func Start(config *config.GlobalConfig, client discoveryregistry.SvcDiscoveryReg } func (s *groupServer) GetJoinedGroupIDs(ctx context.Context, req *pbgroup.GetJoinedGroupIDsReq) (*pbgroup.GetJoinedGroupIDsResp, error) { - //TODO implement me + // TODO implement me panic("implement me") } diff --git a/internal/rpc/msg/as_read.go b/internal/rpc/msg/as_read.go index e40a4a5b3..345d2916e 100644 --- a/internal/rpc/msg/as_read.go +++ b/internal/rpc/msg/as_read.go @@ -155,7 +155,7 @@ func (m *msgServer) MarkConversationAsRead(ctx context.Context, req *msg.MarkCon for i := hasReadSeq + 1; i <= req.HasReadSeq; i++ { seqs = append(seqs, i) } - //avoid client missed call MarkConversationMessageAsRead by order + // avoid client missed call MarkConversationMessageAsRead by order for _, val := range req.Seqs { if !utils2.Contain(val, seqs...) { seqs = append(seqs, val) diff --git a/internal/rpc/msg/send.go b/internal/rpc/msg/send.go index 346cbd83f..64aa0fce7 100644 --- a/internal/rpc/msg/send.go +++ b/internal/rpc/msg/send.go @@ -101,7 +101,7 @@ func (m *msgServer) setConversationAtInfo(nctx context.Context, msg *sdkws.MsgDa atUserID = utils.DifferenceString([]string{constant.AtAllString}, msg.AtUserIDList) if len(atUserID) == 0 { // just @everyone conversation.GroupAtType = &wrapperspb.Int32Value{Value: constant.AtAll} - } else { //@Everyone and @other people + } else { // @Everyone and @other people conversation.GroupAtType = &wrapperspb.Int32Value{Value: constant.AtAllAtMe} err = m.Conversation.SetConversations(ctx, atUserID, conversation) if err != nil { diff --git a/internal/rpc/msg/server.go b/internal/rpc/msg/server.go index 5bde7f4d2..ccca08e5f 100644 --- a/internal/rpc/msg/server.go +++ b/internal/rpc/msg/server.go @@ -51,7 +51,7 @@ func (m *msgServer) addInterceptorHandler(interceptorFunc ...MessageInterceptorF m.Handlers = append(m.Handlers, interceptorFunc...) } -//func (m *msgServer) execInterceptorHandler(ctx context.Context, config *config.GlobalConfig, req *msg.SendMsgReq) error { +// func (m *msgServer) execInterceptorHandler(ctx context.Context, config *config.GlobalConfig, req *msg.SendMsgReq) error { // for _, handler := range m.Handlers { // msgData, err := handler(ctx, config, req) // if err != nil { diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index 40e4b9dbe..48fcb61bf 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -55,7 +55,7 @@ type userServer struct { } func (s *userServer) GetGroupOnlineUser(ctx context.Context, req *pbuser.GetGroupOnlineUserReq) (*pbuser.GetGroupOnlineUserResp, error) { - //TODO implement me + // TODO implement me panic("implement me") } diff --git a/internal/tools/conversation.go b/internal/tools/conversation.go index b555a3361..d272c4dc6 100644 --- a/internal/tools/conversation.go +++ b/internal/tools/conversation.go @@ -26,7 +26,7 @@ import ( "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation" ) -//func (c *MsgTool) ConversationsDestructMsgs() { +// func (c *MsgTool) ConversationsDestructMsgs() { // log.ZInfo(context.Background(), "start msg destruct cron task") // ctx := mcontext.NewCtx(utils.GetSelfFuncName()) // conversations, err := c.conversationDatabase.GetConversationIDsNeedDestruct(ctx) diff --git a/internal/tools/msg.go b/internal/tools/msg.go index 2bdf3113f..3dda2e441 100644 --- a/internal/tools/msg.go +++ b/internal/tools/msg.go @@ -121,7 +121,7 @@ func InitMsgTool(config *config.GlobalConfig) (*MsgTool, error) { return msgTool, nil } -//func (c *MsgTool) AllConversationClearMsgAndFixSeq() { +// func (c *MsgTool) AllConversationClearMsgAndFixSeq() { // ctx := mcontext.NewCtx(utils.GetSelfFuncName()) // log.ZInfo(ctx, "============================ start del cron task ============================") // conversationIDs, err := c.conversationDatabase.GetAllConversationIDs(ctx) diff --git a/pkg/common/convert/group.go b/pkg/common/convert/group.go index 4a888d6e1..dadd3493d 100644 --- a/pkg/common/convert/group.go +++ b/pkg/common/convert/group.go @@ -128,7 +128,7 @@ func Pb2DBGroupInfo(m *sdkws.GroupInfo) *relation.GroupModel { } } -//func Pb2DbGroupMember(m *sdkws.UserInfo) *relation.GroupMemberModel { +// func Pb2DbGroupMember(m *sdkws.UserInfo) *relation.GroupMemberModel { // return &relation.GroupMemberModel{ // UserID: m.UserID, // Nickname: m.Nickname, diff --git a/pkg/common/db/cache/conversation.go b/pkg/common/db/cache/conversation.go index 1b39e2a8c..a2fc73e0d 100644 --- a/pkg/common/db/cache/conversation.go +++ b/pkg/common/db/cache/conversation.go @@ -30,7 +30,7 @@ import ( ) const ( - //ConversationKey = "CONVERSATION:" + // ConversationKey = "CONVERSATION:" //conversationIDsKey = "CONVERSATION_IDS:" //conversationIDsHashKey = "CONVERSATION_IDS_HASH:" //conversationHasReadSeqKey = "CONVERSATION_HAS_READ_SEQ:" @@ -66,13 +66,13 @@ type ConversationCache interface { GetUserRecvMsgOpt(ctx context.Context, ownerUserID, conversationID string) (opt int, err error) DelUserRecvMsgOpt(ownerUserID, conversationID string) ConversationCache // get one super group recv msg but do not notification userID list - //GetSuperGroupRecvMsgNotNotifyUserIDs(ctx context.Context, groupID string) (userIDs []string, err error) + // GetSuperGroupRecvMsgNotNotifyUserIDs(ctx context.Context, groupID string) (userIDs []string, err error) DelSuperGroupRecvMsgNotNotifyUserIDs(groupID string) ConversationCache // get one super group recv msg but do not notification userID list hash - //GetSuperGroupRecvMsgNotNotifyUserIDsHash(ctx context.Context, groupID string) (hash uint64, err error) + // GetSuperGroupRecvMsgNotNotifyUserIDsHash(ctx context.Context, groupID string) (hash uint64, err error) DelSuperGroupRecvMsgNotNotifyUserIDsHash(groupID string) ConversationCache - //GetUserAllHasReadSeqs(ctx context.Context, ownerUserID string) (map[string]int64, error) + // GetUserAllHasReadSeqs(ctx context.Context, ownerUserID string) (map[string]int64, error) DelUserAllHasReadSeqs(ownerUserID string, conversationIDs ...string) ConversationCache GetConversationsByConversationID(ctx context.Context, @@ -104,7 +104,7 @@ type ConversationRedisCache struct { expireTime time.Duration } -//func NewNewConversationRedis( +// func NewNewConversationRedis( // rdb redis.UniversalClient, // conversationDB *relation.ConversationGorm, // options rockscache.Options, @@ -236,7 +236,7 @@ func (c *ConversationRedisCache) DelConversations(ownerUserID string, conversati // } func (c *ConversationRedisCache) GetConversations(ctx context.Context, ownerUserID string, conversationIDs []string) ([]*relationtb.ConversationModel, error) { - //var keys []string + // var keys []string //for _, conversarionID := range conversationIDs { // keys = append(keys, c.getConversationKey(ownerUserID, conversarionID)) //} @@ -262,7 +262,7 @@ func (c *ConversationRedisCache) GetUserAllConversations(ctx context.Context, ow if err != nil { return nil, err } - //var keys []string + // var keys []string //for _, conversarionID := range conversationIDs { // keys = append(keys, c.getConversationKey(ownerUserID, conversarionID)) //} @@ -285,7 +285,7 @@ func (c *ConversationRedisCache) GetUserRecvMsgOpt(ctx context.Context, ownerUse }) } -//func (c *ConversationRedisCache) GetSuperGroupRecvMsgNotNotifyUserIDs(ctx context.Context, groupID string) (userIDs []string, err error) { +// func (c *ConversationRedisCache) GetSuperGroupRecvMsgNotNotifyUserIDs(ctx context.Context, groupID string) (userIDs []string, err error) { // return getCache(ctx, c.rcClient, c.getSuperGroupRecvNotNotifyUserIDsKey(groupID), c.expireTime, func(ctx context.Context) (userIDs []string, err error) { // return c.conversationDB.FindSuperGroupRecvMsgNotNotifyUserIDs(ctx, groupID) // }) @@ -316,7 +316,7 @@ func (c *ConversationRedisCache) DelSuperGroupRecvMsgNotNotifyUserIDs(groupID st return cache } -//func (c *ConversationRedisCache) GetSuperGroupRecvMsgNotNotifyUserIDsHash(ctx context.Context, groupID string) (hash uint64, err error) { +// func (c *ConversationRedisCache) GetSuperGroupRecvMsgNotNotifyUserIDsHash(ctx context.Context, groupID string) (hash uint64, err error) { // return getCache(ctx, c.rcClient, c.getSuperGroupRecvNotNotifyUserIDsHashKey(groupID), c.expireTime, func(ctx context.Context) (hash uint64, err error) { // userIDs, err := c.GetSuperGroupRecvMsgNotNotifyUserIDs(ctx, groupID) // if err != nil { diff --git a/pkg/common/db/cache/friend.go b/pkg/common/db/cache/friend.go index 233e7fdae..82af07072 100644 --- a/pkg/common/db/cache/friend.go +++ b/pkg/common/db/cache/friend.go @@ -29,7 +29,7 @@ import ( const ( friendExpireTime = time.Second * 60 * 60 * 12 - //FriendIDsKey = "FRIEND_IDS:" + // FriendIDsKey = "FRIEND_IDS:" //TwoWayFriendsIDsKey = "COMMON_FRIENDS_IDS:" //friendKey = "FRIEND_INFO:". ) diff --git a/pkg/common/db/cache/group.go b/pkg/common/db/cache/group.go index b2e3924a5..20d355c3b 100644 --- a/pkg/common/db/cache/group.go +++ b/pkg/common/db/cache/group.go @@ -32,7 +32,7 @@ import ( const ( groupExpireTime = time.Second * 60 * 60 * 12 - //GroupInfoKey = "GROUP_INFO:" + // GroupInfoKey = "GROUP_INFO:" //groupMemberIDsKey = "GROUP_MEMBER_IDS:" //groupMembersHashKey = "GROUP_MEMBERS_HASH2:" //groupMemberInfoKey = "GROUP_MEMBER_INFO:" diff --git a/pkg/common/db/cache/meta_cache.go b/pkg/common/db/cache/meta_cache.go index 6a4e7d7d0..26a09a1f0 100644 --- a/pkg/common/db/cache/meta_cache.go +++ b/pkg/common/db/cache/meta_cache.go @@ -240,7 +240,7 @@ func batchGetCache2[T any, K comparable]( return res, nil } -//func batchGetCacheMap[T any]( +// func batchGetCacheMap[T any]( // ctx context.Context, // rcClient *rockscache.Client, // keys, originKeys []string, diff --git a/pkg/common/db/cache/msg.go b/pkg/common/db/cache/msg.go index 1aacc6cb0..a124d2185 100644 --- a/pkg/common/db/cache/msg.go +++ b/pkg/common/db/cache/msg.go @@ -38,10 +38,10 @@ const ( conversationUserMinSeq = "CON_USER_MIN_SEQ:" hasReadSeq = "HAS_READ_SEQ:" - //AppleDeviceToken = "DEVICE_TOKEN". + // AppleDeviceToken = "DEVICE_TOKEN". getuiToken = "GETUI_TOKEN" getuiTaskID = "GETUI_TASK_ID" - //SignalCache = "SIGNAL_CACHE:" + // SignalCache = "SIGNAL_CACHE:" //signalListCache = "SIGNAL_LIST_CACHE:". FCM_TOKEN = "FCM_TOKEN:" @@ -507,7 +507,7 @@ func (c *msgCache) UserDeleteMsgs(ctx context.Context, conversationID string, se } return nil - //pipe := c.rdb.Pipeline() + // pipe := c.rdb.Pipeline() //for _, seq := range seqs { // delUserListKey := c.getMessageDelUserListKey(conversationID, seq) // userDelListKey := c.getUserDelList(conversationID, userID) @@ -567,7 +567,7 @@ func (c *msgCache) DelUserDeleteMsgsList(ctx context.Context, conversationID str } } } - //for _, seq := range seqs { + // for _, seq := range seqs { // delUsers, err := c.rdb.SMembers(ctx, c.getMessageDelUserListKey(conversationID, seq)).Result() // if err != nil { // log.ZWarn(ctx, "DelUserDeleteMsgsList failed", err, "conversationID", conversationID, "seq", seq) diff --git a/pkg/common/db/cache/user.go b/pkg/common/db/cache/user.go index bdee4383f..123788170 100644 --- a/pkg/common/db/cache/user.go +++ b/pkg/common/db/cache/user.go @@ -35,7 +35,7 @@ import ( const ( userExpireTime = time.Second * 60 * 60 * 12 - //UserInfoKey = "USER_INFO:". + // UserInfoKey = "USER_INFO:". userGlobalRecvMsgOptKey = "USER_GLOBAL_RECV_MSG_OPT_KEY:" olineStatusKey = "ONLINE_STATUS:" userOlineStatusExpireTime = time.Second * 60 * 60 * 24 @@ -58,7 +58,7 @@ type UserCache interface { type UserCacheRedis struct { metaCache rdb redis.UniversalClient - //userDB relationtb.UserModelInterface + // userDB relationtb.UserModelInterface userDB relationtb.UserModelInterface expireTime time.Duration rcClient *rockscache.Client diff --git a/pkg/common/db/mgo/conversation.go b/pkg/common/db/mgo/conversation.go index bc37ed759..4b9de9154 100644 --- a/pkg/common/db/mgo/conversation.go +++ b/pkg/common/db/mgo/conversation.go @@ -141,7 +141,7 @@ func (c *ConversationMgo) GetConversationsByConversationID(ctx context.Context, } func (c *ConversationMgo) GetConversationIDsNeedDestruct(ctx context.Context) ([]*relation.ConversationModel, error) { - //"is_msg_destruct = 1 && msg_destruct_time != 0 && (UNIX_TIMESTAMP(NOW()) > (msg_destruct_time + UNIX_TIMESTAMP(latest_msg_destruct_time)) || latest_msg_destruct_time is NULL)" + // "is_msg_destruct = 1 && msg_destruct_time != 0 && (UNIX_TIMESTAMP(NOW()) > (msg_destruct_time + UNIX_TIMESTAMP(latest_msg_destruct_time)) || latest_msg_destruct_time is NULL)" return mgoutil.Find[*relation.ConversationModel](ctx, c.coll, bson.M{ "is_msg_destruct": 1, "msg_destruct_time": bson.M{"$ne": 0}, diff --git a/pkg/common/db/mgo/group_member.go b/pkg/common/db/mgo/group_member.go index e1af34f7c..20671ead8 100644 --- a/pkg/common/db/mgo/group_member.go +++ b/pkg/common/db/mgo/group_member.go @@ -67,7 +67,7 @@ func (g *GroupMemberMgo) Update(ctx context.Context, groupID string, userID stri } func (g *GroupMemberMgo) Find(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32) (groupMembers []*relation.GroupMemberModel, err error) { - //TODO implement me + // TODO implement me panic("implement me") } diff --git a/pkg/common/db/table/relation/black.go b/pkg/common/db/table/relation/black.go index 50499054c..3f37b8ac3 100644 --- a/pkg/common/db/table/relation/black.go +++ b/pkg/common/db/table/relation/black.go @@ -33,7 +33,7 @@ type BlackModel struct { type BlackModelInterface interface { Create(ctx context.Context, blacks []*BlackModel) (err error) Delete(ctx context.Context, blacks []*BlackModel) (err error) - //UpdateByMap(ctx context.Context, ownerUserID, blockUserID string, args map[string]any) (err error) + // UpdateByMap(ctx context.Context, ownerUserID, blockUserID string, args map[string]any) (err error) //Update(ctx context.Context, blacks []*BlackModel) (err error) Find(ctx context.Context, blacks []*BlackModel) (blackList []*BlackModel, err error) Take(ctx context.Context, ownerUserID, blockUserID string) (black *BlackModel, err error) diff --git a/pkg/common/db/table/relation/group_member.go b/pkg/common/db/table/relation/group_member.go index 88ab87739..bf3d5bf63 100644 --- a/pkg/common/db/table/relation/group_member.go +++ b/pkg/common/db/table/relation/group_member.go @@ -36,10 +36,10 @@ type GroupMemberModel struct { } type GroupMemberModelInterface interface { - //NewTx(tx any) GroupMemberModelInterface + // NewTx(tx any) GroupMemberModelInterface Create(ctx context.Context, groupMembers []*GroupMemberModel) (err error) Delete(ctx context.Context, groupID string, userIDs []string) (err error) - //DeleteGroup(ctx context.Context, groupIDs []string) (err error) + // DeleteGroup(ctx context.Context, groupIDs []string) (err error) Update(ctx context.Context, groupID string, userID string, data map[string]any) (err error) UpdateRoleLevel(ctx context.Context, groupID string, userID string, roleLevel int32) error FindMemberUserID(ctx context.Context, groupID string) (userIDs []string, err error) @@ -47,11 +47,11 @@ type GroupMemberModelInterface interface { TakeOwner(ctx context.Context, groupID string) (groupMember *GroupMemberModel, err error) SearchMember(ctx context.Context, keyword string, groupID string, pagination pagination.Pagination) (total int64, groupList []*GroupMemberModel, err error) FindRoleLevelUserIDs(ctx context.Context, groupID string, roleLevel int32) ([]string, error) - //MapGroupMemberNum(ctx context.Context, groupIDs []string) (count map[string]uint32, err error) + // MapGroupMemberNum(ctx context.Context, groupIDs []string) (count map[string]uint32, err error) //FindJoinUserID(ctx context.Context, groupIDs []string) (groupUsers map[string][]string, err error) FindUserJoinedGroupID(ctx context.Context, userID string) (groupIDs []string, err error) TakeGroupMemberNum(ctx context.Context, groupID string) (count int64, err error) - //FindUsersJoinedGroupID(ctx context.Context, userIDs []string) (map[string][]string, error) + // FindUsersJoinedGroupID(ctx context.Context, userIDs []string) (map[string][]string, error) FindUserManagedGroupID(ctx context.Context, userID string) (groupIDs []string, err error) IsUpdateRoleLevel(data map[string]any) bool } diff --git a/pkg/common/db/table/relation/user.go b/pkg/common/db/table/relation/user.go index 375930ddf..6c87372e9 100644 --- a/pkg/common/db/table/relation/user.go +++ b/pkg/common/db/table/relation/user.go @@ -65,7 +65,7 @@ type UserModelInterface interface { CountTotal(ctx context.Context, before *time.Time) (count int64, err error) // Get user total quantity every day CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error) - //CRUD user command + // CRUD user command AddUserCommand(ctx context.Context, userID string, Type int32, UUID string, value string, ex string) error DeleteUserCommand(ctx context.Context, userID string, Type int32, UUID string) error UpdateUserCommand(ctx context.Context, userID string, Type int32, UUID string, val map[string]any) error diff --git a/pkg/common/db/table/unrelation/super_group.go b/pkg/common/db/table/unrelation/super_group.go index 1fd80c67a..e6698139b 100644 --- a/pkg/common/db/table/unrelation/super_group.go +++ b/pkg/common/db/table/unrelation/super_group.go @@ -14,7 +14,7 @@ package unrelation -//import ( +// import ( // "context" //) // diff --git a/pkg/common/db/unrelation/super_group.go b/pkg/common/db/unrelation/super_group.go index 6c2bb6aaf..2178f222a 100644 --- a/pkg/common/db/unrelation/super_group.go +++ b/pkg/common/db/unrelation/super_group.go @@ -15,7 +15,7 @@ package unrelation // -//import ( +// import ( // "context" // // "go.mongodb.org/mongo-driver/bson" diff --git a/pkg/common/discoveryregister/zookeeper/zookeeper.go b/pkg/common/discoveryregister/zookeeper/zookeeper.go index 55eb96c4c..ec711551f 100644 --- a/pkg/common/discoveryregister/zookeeper/zookeeper.go +++ b/pkg/common/discoveryregister/zookeeper/zookeeper.go @@ -40,7 +40,7 @@ func NewZookeeperDiscoveryRegister(zkConf *config.Zookeeper) (discoveryregistry. openkeeper.WithUserNameAndPassword(username, password), openkeeper.WithRoundRobin(), openkeeper.WithTimeout(10), - //openkeeper.WithLogger(log.NewZkLogger()), + // openkeeper.WithLogger(log.NewZkLogger()), ) if err != nil { uriFormat := "address:%s, username:%s, password:%s, schema:%s." diff --git a/pkg/common/version/types.go b/pkg/common/version/types.go index da9c1ed90..6753c49a7 100644 --- a/pkg/common/version/types.go +++ b/pkg/common/version/types.go @@ -35,7 +35,7 @@ type Output struct { } type OpenIMClientVersion struct { - ClientVersion string `json:"clientVersion,omitempty" yaml:"clientVersion,omitempty"` //sdk core version + ClientVersion string `json:"clientVersion,omitempty" yaml:"clientVersion,omitempty"` // sdk core version } // String returns info as a human-friendly version string. diff --git a/pkg/rpcclient/msg.go b/pkg/rpcclient/msg.go index f9c3ded7f..e201ef7fc 100644 --- a/pkg/rpcclient/msg.go +++ b/pkg/rpcclient/msg.go @@ -68,7 +68,7 @@ func newContentTypeConf(conf *config.Notification) map[int32]config.Notification constant.BlackAddedNotification: conf.BlackAdded, constant.BlackDeletedNotification: conf.BlackDeleted, constant.FriendInfoUpdatedNotification: conf.FriendInfoUpdated, - constant.FriendsInfoUpdateNotification: conf.FriendInfoUpdated, //use the same FriendInfoUpdated + constant.FriendsInfoUpdateNotification: conf.FriendInfoUpdated, // use the same FriendInfoUpdated // conversation constant.ConversationChangeNotification: conf.ConversationChanged, constant.ConversationUnreadNotification: conf.ConversationChanged, diff --git a/pkg/rpcclient/notification/friend.go b/pkg/rpcclient/notification/friend.go index 39c65d039..59428e9ad 100644 --- a/pkg/rpcclient/notification/friend.go +++ b/pkg/rpcclient/notification/friend.go @@ -218,7 +218,7 @@ func (f *FriendNotificationSender) BlackDeletedNotification(ctx context.Context, ToUserID: req.BlackUserID, }} if err := f.Notification(ctx, req.OwnerUserID, req.BlackUserID, constant.BlackDeletedNotification, &blackDeletedTips); err != nil { - //err + // err } }