Fix lint errors in modified code in the /pkg directory (#1962)

* /pkg-make lint

Signed-off-by: longyuqing112 <105913803+longyuqing112@users.noreply.github.com>

* /pkg_make_lint

Signed-off-by: longyuqing112 <105913803+longyuqing112@users.noreply.github.com>

---------

Signed-off-by: longyuqing112 <105913803+longyuqing112@users.noreply.github.com>
pull/1963/head
longyuqing112 10 months ago committed by GitHub
parent ac8775827d
commit 2becd46bdd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -121,6 +121,7 @@ require (
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rs/xid v1.5.0 // indirect github.com/rs/xid v1.5.0 // indirect
github.com/sergi/go-diff v1.0.0 // indirect github.com/sergi/go-diff v1.0.0 // indirect
github.com/smallstep/cli v0.25.2 // indirect
github.com/src-d/gcfg v1.4.0 // indirect github.com/src-d/gcfg v1.4.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect github.com/stretchr/objx v0.5.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect

@ -312,6 +312,8 @@ github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smallstep/cli v0.25.2 h1:vkwnKLAAXj9vA3SJHqa0ytz2orHMUJn/glv79UuAthQ=
github.com/smallstep/cli v0.25.2/go.mod h1:g0jvoTvGKFhw2PeFXwA2E99k9rTX4J3Vc983i+jbVKM=
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=

@ -259,7 +259,7 @@ func (a *Aws) StatObject(ctx context.Context, name string) (*s3.ObjectInfo, erro
return res, nil return res, nil
} }
// AccessURL todo // AccessURL todo.
func (a *Aws) AccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption) (string, error) { func (a *Aws) AccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption) (string, error) {
// todo // todo
return "", nil return "", nil

@ -64,7 +64,7 @@ func (u *UserMongoDriver) AddSubscriptionList(ctx context.Context, userID string
} }
// iterate over aggregated results // iterate over aggregated results
for cursor.Next(ctx) { for cursor.Next(ctx) {
err := cursor.Decode(&cnt) err = cursor.Decode(&cnt)
if err != nil { if err != nil {
return errs.Wrap(err) return errs.Wrap(err)
} }

@ -29,6 +29,8 @@ import (
"github.com/OpenIMSDK/tools/mcontext" "github.com/OpenIMSDK/tools/mcontext"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
"fmt"
"github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/config"
) )
@ -118,7 +120,11 @@ func configureProducerAck(p *Producer, ackConfig string) {
// configureCompression configures the message compression type for the producer. // configureCompression configures the message compression type for the producer.
func configureCompression(p *Producer, compressType string) { func configureCompression(p *Producer, compressType string) {
var compress sarama.CompressionCodec = sarama.CompressionNone var compress sarama.CompressionCodec = sarama.CompressionNone
compress.UnmarshalText(bytes.ToLower([]byte(compressType))) err := compress.UnmarshalText(bytes.ToLower([]byte(compressType)))
if err != nil {
fmt.Printf("Failed to configure compression: %v\n", err)
return
}
p.config.Producer.Compression = compress p.config.Producer.Compression = compress
} }

@ -109,6 +109,7 @@ func (f *FriendNotificationSender) getUsersInfoMap(
return result, nil return result, nil
} }
//nolint:unused
func (f *FriendNotificationSender) getFromToUserNickname( func (f *FriendNotificationSender) getFromToUserNickname(
ctx context.Context, ctx context.Context,
fromUserID, toUserID string, fromUserID, toUserID string,
@ -214,7 +215,9 @@ func (f *FriendNotificationSender) BlackDeletedNotification(ctx context.Context,
FromUserID: req.OwnerUserID, FromUserID: req.OwnerUserID,
ToUserID: req.BlackUserID, ToUserID: req.BlackUserID,
}} }}
f.Notification(ctx, req.OwnerUserID, req.BlackUserID, constant.BlackDeletedNotification, &blackDeletedTips) if err := f.Notification(ctx, req.OwnerUserID, req.BlackUserID, constant.BlackDeletedNotification, &blackDeletedTips); err != nil {
//err
}
} }
func (f *FriendNotificationSender) FriendInfoUpdatedNotification( func (f *FriendNotificationSender) FriendInfoUpdatedNotification(
@ -223,5 +226,8 @@ func (f *FriendNotificationSender) FriendInfoUpdatedNotification(
needNotifiedUserID string, needNotifiedUserID string,
) { ) {
tips := sdkws.UserInfoUpdatedTips{UserID: changedUserID} tips := sdkws.UserInfoUpdatedTips{UserID: changedUserID}
f.Notification(ctx, mcontext.GetOpUserID(ctx), needNotifiedUserID, constant.FriendInfoUpdatedNotification, &tips) if err := f.Notification(ctx, mcontext.GetOpUserID(ctx), needNotifiedUserID,
constant.FriendInfoUpdatedNotification, &tips); err != nil {
// err
}
} }

@ -192,6 +192,7 @@ func (g *GroupNotificationSender) getGroupOwnerAndAdminUserID(ctx context.Contex
return utils.Slice(members, fn), nil return utils.Slice(members, fn), nil
} }
//nolint:unused
func (g *GroupNotificationSender) groupDB2PB(group *relation.GroupModel, ownerUserID string, memberCount uint32) *sdkws.GroupInfo { func (g *GroupNotificationSender) groupDB2PB(group *relation.GroupModel, ownerUserID string, memberCount uint32) *sdkws.GroupInfo {
return &sdkws.GroupInfo{ return &sdkws.GroupInfo{
GroupID: group.GroupID, GroupID: group.GroupID,
@ -231,7 +232,7 @@ func (g *GroupNotificationSender) groupMemberDB2PB(member *relation.GroupMemberM
} }
} }
func (g *GroupNotificationSender) getUsersInfoMap(ctx context.Context, userIDs []string) (map[string]*sdkws.UserInfo, error) { /* func (g *GroupNotificationSender) getUsersInfoMap(ctx context.Context, userIDs []string) (map[string]*sdkws.UserInfo, error) {
users, err := g.getUsersInfo(ctx, userIDs) users, err := g.getUsersInfo(ctx, userIDs)
if err != nil { if err != nil {
return nil, err return nil, err
@ -241,7 +242,7 @@ func (g *GroupNotificationSender) getUsersInfoMap(ctx context.Context, userIDs [
result[user.GetUserID()] = user.(*sdkws.UserInfo) result[user.GetUserID()] = user.(*sdkws.UserInfo)
} }
return result, nil return result, nil
} } */
func (g *GroupNotificationSender) fillOpUser(ctx context.Context, opUser **sdkws.GroupMemberFullInfo, groupID string) (err error) { func (g *GroupNotificationSender) fillOpUser(ctx context.Context, opUser **sdkws.GroupMemberFullInfo, groupID string) (err error) {
defer log.ZDebug(ctx, "return") defer log.ZDebug(ctx, "return")
@ -266,11 +267,11 @@ func (g *GroupNotificationSender) fillOpUser(ctx context.Context, opUser **sdkws
AppMangerLevel: constant.AppAdmin, AppMangerLevel: constant.AppAdmin,
} }
} else { } else {
member, err := g.db.TakeGroupMember(ctx, groupID, userID) member, err2 := g.db.TakeGroupMember(ctx, groupID, userID)
if err == nil { if err2 == nil {
*opUser = g.groupMemberDB2PB(member, 0) *opUser = g.groupMemberDB2PB(member, 0)
} else if !errs.ErrRecordNotFound.Is(err) { } else if !errs.ErrRecordNotFound.Is(err2) {
return err return err2
} }
} }
} }

@ -71,7 +71,7 @@ func NewUserNotificationSender(
return f return f
} }
func (u *UserNotificationSender) getUsersInfoMap( /* func (u *UserNotificationSender) getUsersInfoMap(
ctx context.Context, ctx context.Context,
userIDs []string, userIDs []string,
) (map[string]*sdkws.UserInfo, error) { ) (map[string]*sdkws.UserInfo, error) {
@ -84,9 +84,9 @@ func (u *UserNotificationSender) getUsersInfoMap(
result[user.GetUserID()] = user.(*sdkws.UserInfo) result[user.GetUserID()] = user.(*sdkws.UserInfo)
} }
return result, nil return result, nil
} } */
func (u *UserNotificationSender) getFromToUserNickname( /* func (u *UserNotificationSender) getFromToUserNickname(
ctx context.Context, ctx context.Context,
fromUserID, toUserID string, fromUserID, toUserID string,
) (string, string, error) { ) (string, string, error) {
@ -95,7 +95,7 @@ func (u *UserNotificationSender) getFromToUserNickname(
return "", "", nil return "", "", nil
} }
return users[fromUserID].Nickname, users[toUserID].Nickname, nil return users[fromUserID].Nickname, users[toUserID].Nickname, nil
} } */
func (u *UserNotificationSender) UserStatusChangeNotification( func (u *UserNotificationSender) UserStatusChangeNotification(
ctx context.Context, ctx context.Context,

Loading…
Cancel
Save