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/driver/mysql
|
||||
- k8s.io/klog
|
||||
- github.com/allowed/module
|
||||
- go.mongodb.org/mongo-driver/mongo
|
||||
# - gopkg.in/yaml.v2
|
||||
domains: # List of allowed module domains
|
||||
- google.golang.org
|
||||
- gopkg.in
|
||||
- golang.org
|
||||
- github.com
|
||||
- go.mongodb.org
|
||||
- go.uber.org
|
||||
- openim.io
|
||||
- go.etcd.io
|
||||
blocked:
|
||||
versions:
|
||||
|
|
|
@ -61,11 +61,11 @@ func run(port int) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := client.CreateRpcRootNodes(config.Config.GetServiceNames()); err != nil {
|
||||
if err = client.CreateRpcRootNodes(config.Config.GetServiceNames()); err != nil {
|
||||
return err
|
||||
}
|
||||
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
|
||||
}
|
||||
fmt.Println("api register public config to discov success")
|
||||
|
@ -82,7 +82,9 @@ func run(port int) error {
|
|||
err = router.Run(address)
|
||||
if err != nil {
|
||||
log.ZError(context.Background(), "api run failed ", err, "address", address)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ func (o *ThirdApi) ObjectRedirect(c *gin.Context) {
|
|||
c.Redirect(http.StatusFound, resp.Url)
|
||||
}
|
||||
|
||||
// #################### logs ####################
|
||||
// #################### logs ####################.
|
||||
func (o *ThirdApi) UploadLogs(c *gin.Context) {
|
||||
a2r.Call(third.ThirdClient.UploadLogs, o.Client, c)
|
||||
}
|
||||
|
|
|
@ -120,6 +120,7 @@ func (d *GWebSocket) SetReadLimit(limit int64) {
|
|||
func (d *GWebSocket) SetPongHandler(handler PingPongHandler) {
|
||||
d.conn.SetPongHandler(handler)
|
||||
}
|
||||
|
||||
func (d *GWebSocket) SetPingHandler(handler PingPongHandler) {
|
||||
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) {
|
||||
|
||||
if err := authverify.CheckAdmin(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -414,7 +414,8 @@ func (c *ConversationRedisCache) GetUserAllHasReadSeqs(
|
|||
}
|
||||
|
||||
func (c *ConversationRedisCache) DelUserAllHasReadSeqs(ownerUserID string,
|
||||
conversationIDs ...string) ConversationCache {
|
||||
conversationIDs ...string,
|
||||
) ConversationCache {
|
||||
cache := c.NewCache()
|
||||
for _, conversationID := range conversationIDs {
|
||||
cache.AddKeys(c.getConversationHasReadSeqKey(ownerUserID, conversationID))
|
||||
|
|
|
@ -28,7 +28,7 @@ import (
|
|||
type ThirdDatabase interface {
|
||||
FcmUpdateToken(ctx context.Context, account string, platformID int, fcmToken string, expireTime int64) 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
|
||||
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)
|
||||
|
@ -60,7 +60,6 @@ func (t *thirdDatabase) GetLogs(ctx context.Context, LogIDs []string, userID str
|
|||
// 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) {
|
||||
return t.logdb.Search(ctx, keyword, start, end, pageNumber, showNumber)
|
||||
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
func NewLogGorm(db *gorm.DB) relationtb.LogInterface {
|
||||
db.AutoMigrate(&relationtb.Log{})
|
||||
return &LogGorm{db: db}
|
||||
|
|
|
@ -46,7 +46,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
// defaultCfgPath is the default path of the configuration file
|
||||
// defaultCfgPath is the default path of the configuration file.
|
||||
defaultCfgPath = "../../../../../config/config.yaml"
|
||||
minioHealthCheckDuration = 1
|
||||
maxRetry = 100
|
||||
|
@ -66,6 +66,7 @@ func initCfg() error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return yaml.Unmarshal(data, &config.Config)
|
||||
}
|
||||
|
||||
|
@ -79,6 +80,7 @@ func main() {
|
|||
|
||||
if err := initCfg(); err != nil {
|
||||
fmt.Printf("Read config failed: %v\n", err)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -111,6 +113,7 @@ func main() {
|
|||
|
||||
if allSuccess {
|
||||
successPrint("All components started successfully!")
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -126,9 +129,11 @@ func exactIP(urll string) string {
|
|||
if strings.HasSuffix(host, ":") {
|
||||
host = host[0 : len(host)-1]
|
||||
}
|
||||
|
||||
return host
|
||||
}
|
||||
|
||||
|
||||
func checkMysql() error {
|
||||
var sqlDB *sql.DB
|
||||
defer func() {
|
||||
|
@ -148,6 +153,7 @@ func checkMysql() error {
|
|||
return errs.Wrap(err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -177,6 +183,7 @@ func checkMongo() error {
|
|||
return errs.Wrap(err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -209,6 +216,7 @@ func checkMinio() error {
|
|||
return ErrConfig.Wrap("apiURL or Minio SignEndpoint endpoint contain 127.0.0.1")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -236,6 +244,7 @@ func checkRedis() error {
|
|||
if err != nil {
|
||||
return errs.Wrap(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -260,6 +269,7 @@ func checkZookeeper() error {
|
|||
return errs.Wrap(err)
|
||||
}
|
||||
}
|
||||
|
||||
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 nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue