mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-23 13:29:20 +08:00
fix: make lint about cicd (#1161)
* fix: make lint Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * fix: make lint Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> --------- Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
This commit is contained in:
parent
717ed8fd12
commit
c5f6514f98
@ -361,13 +361,17 @@ linters-settings:
|
|||||||
- gorm.io/gorm
|
- gorm.io/gorm
|
||||||
- gorm.io/driver/mysql
|
- gorm.io/driver/mysql
|
||||||
- k8s.io/klog
|
- k8s.io/klog
|
||||||
|
- github.com/allowed/module
|
||||||
|
- go.mongodb.org/mongo-driver/mongo
|
||||||
# - gopkg.in/yaml.v2
|
# - gopkg.in/yaml.v2
|
||||||
domains: # List of allowed module domains
|
domains: # List of allowed module domains
|
||||||
- google.golang.org
|
- google.golang.org
|
||||||
- gopkg.in
|
- gopkg.in
|
||||||
- golang.org
|
- golang.org
|
||||||
- github.com
|
- github.com
|
||||||
|
- go.mongodb.org
|
||||||
- go.uber.org
|
- go.uber.org
|
||||||
|
- openim.io
|
||||||
- go.etcd.io
|
- go.etcd.io
|
||||||
blocked:
|
blocked:
|
||||||
versions:
|
versions:
|
||||||
|
@ -61,11 +61,11 @@ func run(port int) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := client.CreateRpcRootNodes(config.Config.GetServiceNames()); err != nil {
|
if err = client.CreateRpcRootNodes(config.Config.GetServiceNames()); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Println("api register public config to discov")
|
fmt.Println("api register public config to discov")
|
||||||
if err := client.RegisterConf2Registry(constant.OpenIMCommonConfigKey, config.Config.EncodeConfig()); err != nil {
|
if err = client.RegisterConf2Registry(constant.OpenIMCommonConfigKey, config.Config.EncodeConfig()); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Println("api register public config to discov success")
|
fmt.Println("api register public config to discov success")
|
||||||
@ -82,7 +82,9 @@ func run(port int) error {
|
|||||||
err = router.Run(address)
|
err = router.Run(address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ZError(context.Background(), "api run failed ", err, "address", address)
|
log.ZError(context.Background(), "api run failed ", err, "address", address)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ func (o *ThirdApi) ObjectRedirect(c *gin.Context) {
|
|||||||
c.Redirect(http.StatusFound, resp.Url)
|
c.Redirect(http.StatusFound, resp.Url)
|
||||||
}
|
}
|
||||||
|
|
||||||
// #################### logs ####################
|
// #################### logs ####################.
|
||||||
func (o *ThirdApi) UploadLogs(c *gin.Context) {
|
func (o *ThirdApi) UploadLogs(c *gin.Context) {
|
||||||
a2r.Call(third.ThirdClient.UploadLogs, o.Client, c)
|
a2r.Call(third.ThirdClient.UploadLogs, o.Client, c)
|
||||||
}
|
}
|
||||||
|
@ -120,6 +120,7 @@ func (d *GWebSocket) SetReadLimit(limit int64) {
|
|||||||
func (d *GWebSocket) SetPongHandler(handler PingPongHandler) {
|
func (d *GWebSocket) SetPongHandler(handler PingPongHandler) {
|
||||||
d.conn.SetPongHandler(handler)
|
d.conn.SetPongHandler(handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *GWebSocket) SetPingHandler(handler PingPongHandler) {
|
func (d *GWebSocket) SetPingHandler(handler PingPongHandler) {
|
||||||
d.conn.SetPingHandler(handler)
|
d.conn.SetPingHandler(handler)
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,6 @@ func (t *thirdServer) UploadLogs(ctx context.Context, req *third.UploadLogsReq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *thirdServer) DeleteLogs(ctx context.Context, req *third.DeleteLogsReq) (*third.DeleteLogsResp, error) {
|
func (t *thirdServer) DeleteLogs(ctx context.Context, req *third.DeleteLogsReq) (*third.DeleteLogsResp, error) {
|
||||||
|
|
||||||
if err := authverify.CheckAdmin(ctx); err != nil {
|
if err := authverify.CheckAdmin(ctx); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
3
pkg/common/db/cache/conversation.go
vendored
3
pkg/common/db/cache/conversation.go
vendored
@ -414,7 +414,8 @@ func (c *ConversationRedisCache) GetUserAllHasReadSeqs(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *ConversationRedisCache) DelUserAllHasReadSeqs(ownerUserID string,
|
func (c *ConversationRedisCache) DelUserAllHasReadSeqs(ownerUserID string,
|
||||||
conversationIDs ...string) ConversationCache {
|
conversationIDs ...string,
|
||||||
|
) ConversationCache {
|
||||||
cache := c.NewCache()
|
cache := c.NewCache()
|
||||||
for _, conversationID := range conversationIDs {
|
for _, conversationID := range conversationIDs {
|
||||||
cache.AddKeys(c.getConversationHasReadSeqKey(ownerUserID, conversationID))
|
cache.AddKeys(c.getConversationHasReadSeqKey(ownerUserID, conversationID))
|
||||||
|
@ -28,7 +28,7 @@ import (
|
|||||||
type ThirdDatabase interface {
|
type ThirdDatabase interface {
|
||||||
FcmUpdateToken(ctx context.Context, account string, platformID int, fcmToken string, expireTime int64) error
|
FcmUpdateToken(ctx context.Context, account string, platformID int, fcmToken string, expireTime int64) error
|
||||||
SetAppBadge(ctx context.Context, userID string, value int) error
|
SetAppBadge(ctx context.Context, userID string, value int) error
|
||||||
//about log for debug
|
// about log for debug
|
||||||
UploadLogs(ctx context.Context, logs []*relation.Log) error
|
UploadLogs(ctx context.Context, logs []*relation.Log) error
|
||||||
DeleteLogs(ctx context.Context, logID []string, userID string) error
|
DeleteLogs(ctx context.Context, logID []string, userID string) error
|
||||||
SearchLogs(ctx context.Context, keyword string, start time.Time, end time.Time, pageNumber int32, showNumber int32) (uint32, []*relation.Log, error)
|
SearchLogs(ctx context.Context, keyword string, start time.Time, end time.Time, pageNumber int32, showNumber int32) (uint32, []*relation.Log, error)
|
||||||
@ -60,7 +60,6 @@ func (t *thirdDatabase) GetLogs(ctx context.Context, LogIDs []string, userID str
|
|||||||
// SearchLogs implements ThirdDatabase.
|
// SearchLogs implements ThirdDatabase.
|
||||||
func (t *thirdDatabase) SearchLogs(ctx context.Context, keyword string, start time.Time, end time.Time, pageNumber int32, showNumber int32) (uint32, []*relation.Log, error) {
|
func (t *thirdDatabase) SearchLogs(ctx context.Context, keyword string, start time.Time, end time.Time, pageNumber int32, showNumber int32) (uint32, []*relation.Log, error) {
|
||||||
return t.logdb.Search(ctx, keyword, start, end, pageNumber, showNumber)
|
return t.logdb.Search(ctx, keyword, start, end, pageNumber, showNumber)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// UploadLogs implements ThirdDatabase.
|
// UploadLogs implements ThirdDatabase.
|
||||||
|
@ -41,6 +41,7 @@ func (l *LogGorm) Get(ctx context.Context, logIDs []string, userID string) ([]*r
|
|||||||
}
|
}
|
||||||
return logs, errs.Wrap(l.db.WithContext(ctx).Where("log_id in ? and user_id=?", logIDs, userID).Find(&logs).Error)
|
return logs, errs.Wrap(l.db.WithContext(ctx).Where("log_id in ? and user_id=?", logIDs, userID).Find(&logs).Error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewLogGorm(db *gorm.DB) relationtb.LogInterface {
|
func NewLogGorm(db *gorm.DB) relationtb.LogInterface {
|
||||||
db.AutoMigrate(&relationtb.Log{})
|
db.AutoMigrate(&relationtb.Log{})
|
||||||
return &LogGorm{db: db}
|
return &LogGorm{db: db}
|
||||||
|
@ -46,7 +46,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// defaultCfgPath is the default path of the configuration file
|
// defaultCfgPath is the default path of the configuration file.
|
||||||
defaultCfgPath = "../../../../../config/config.yaml"
|
defaultCfgPath = "../../../../../config/config.yaml"
|
||||||
minioHealthCheckDuration = 1
|
minioHealthCheckDuration = 1
|
||||||
maxRetry = 100
|
maxRetry = 100
|
||||||
@ -66,6 +66,7 @@ func initCfg() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return yaml.Unmarshal(data, &config.Config)
|
return yaml.Unmarshal(data, &config.Config)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,6 +80,7 @@ func main() {
|
|||||||
|
|
||||||
if err := initCfg(); err != nil {
|
if err := initCfg(); err != nil {
|
||||||
fmt.Printf("Read config failed: %v\n", err)
|
fmt.Printf("Read config failed: %v\n", err)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,6 +113,7 @@ func main() {
|
|||||||
|
|
||||||
if allSuccess {
|
if allSuccess {
|
||||||
successPrint("All components started successfully!")
|
successPrint("All components started successfully!")
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,9 +129,11 @@ func exactIP(urll string) string {
|
|||||||
if strings.HasSuffix(host, ":") {
|
if strings.HasSuffix(host, ":") {
|
||||||
host = host[0 : len(host)-1]
|
host = host[0 : len(host)-1]
|
||||||
}
|
}
|
||||||
|
|
||||||
return host
|
return host
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func checkMysql() error {
|
func checkMysql() error {
|
||||||
var sqlDB *sql.DB
|
var sqlDB *sql.DB
|
||||||
defer func() {
|
defer func() {
|
||||||
@ -148,6 +153,7 @@ func checkMysql() error {
|
|||||||
return errs.Wrap(err)
|
return errs.Wrap(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,6 +183,7 @@ func checkMongo() error {
|
|||||||
return errs.Wrap(err)
|
return errs.Wrap(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,6 +216,7 @@ func checkMinio() error {
|
|||||||
return ErrConfig.Wrap("apiURL or Minio SignEndpoint endpoint contain 127.0.0.1")
|
return ErrConfig.Wrap("apiURL or Minio SignEndpoint endpoint contain 127.0.0.1")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,6 +244,7 @@ func checkRedis() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errs.Wrap(err)
|
return errs.Wrap(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,6 +269,7 @@ func checkZookeeper() error {
|
|||||||
return errs.Wrap(err)
|
return errs.Wrap(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,6 +305,7 @@ func checkKafka() error {
|
|||||||
return ErrComponentStart.Wrap(fmt.Sprintf("kafka doesn't contain topic:%v", config.Config.Kafka.LatestMsgToRedis.Topic))
|
return ErrComponentStart.Wrap(fmt.Sprintf("kafka doesn't contain topic:%v", config.Config.Kafka.LatestMsgToRedis.Topic))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user