Skip to content

Commit

Permalink
fix: make lint about cicd (#1161)
Browse files Browse the repository at this point in the history
* fix: make lint

Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>

* fix: make lint

Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>

---------

Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>
  • Loading branch information
cubxxw authored Oct 8, 2023
1 parent 717ed8f commit c5f6514
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions cmd/openim-api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
}
2 changes: 1 addition & 1 deletion internal/api/third.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
1 change: 1 addition & 0 deletions internal/msggateway/long_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
1 change: 0 additions & 1 deletion internal/rpc/third/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/common/db/cache/conversation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
3 changes: 1 addition & 2 deletions pkg/common/db/controller/third.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions pkg/common/db/relation/log_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
13 changes: 12 additions & 1 deletion tools/component/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -66,6 +66,7 @@ func initCfg() error {
if err != nil {
return err
}

return yaml.Unmarshal(data, &config.Config)
}

Expand All @@ -79,6 +80,7 @@ func main() {

if err := initCfg(); err != nil {
fmt.Printf("Read config failed: %v\n", err)

return
}

Expand Down Expand Up @@ -111,6 +113,7 @@ func main() {

if allSuccess {
successPrint("All components started successfully!")

return
}
}
Expand All @@ -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() {
Expand All @@ -148,6 +153,7 @@ func checkMysql() error {
return errs.Wrap(err)
}
}

return nil
}

Expand Down Expand Up @@ -177,6 +183,7 @@ func checkMongo() error {
return errs.Wrap(err)
}
}

return nil
}

Expand Down Expand Up @@ -209,6 +216,7 @@ func checkMinio() error {
return ErrConfig.Wrap("apiURL or Minio SignEndpoint endpoint contain 127.0.0.1")
}
}

return nil
}

Expand Down Expand Up @@ -236,6 +244,7 @@ func checkRedis() error {
if err != nil {
return errs.Wrap(err)
}

return nil
}

Expand All @@ -260,6 +269,7 @@ func checkZookeeper() error {
return errs.Wrap(err)
}
}

return nil
}

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit c5f6514

Please sign in to comment.