fix: fix all lint warning in pkg (#1263)

* fix:fix lint errors in internal

* fix:fix lint error in interal/tools

* fix: fix lint errros  in pkg/statics

* fix: fix lint erros in pkg/authverify,pkg/rpcclien

* fix: fix lint erros in pkg/common/cmd

* fix: fix lint erros in pkg/common/config,convert

* fix: fix lint erros in pkg/common/db/cache

* fix: fix lint errors in pkg/common/db/controller

* fix:fix lint errors in pkg/common/db/relation
and pkg/common/db/localcache

* fix: fix rest lint errors in pkg/common/db

* fix: fix rest lint errors in pkg

* fix:set back go.work to use go 1.19
This commit is contained in:
CNCSMonster
2023-10-23 16:24:55 +08:00
committed by GitHub
parent ba190fde13
commit b1415473ff
91 changed files with 1617 additions and 855 deletions
+35
View File
@@ -79,6 +79,7 @@ var (
ConversationCreateFailedCounter prometheus.Counter
)
//nolint:promlinter //no idea to fix it
func NewUserLoginCounter() {
if UserLoginCounter != nil {
return
@@ -89,6 +90,7 @@ func NewUserLoginCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewUserRegisterCounter() {
if UserRegisterCounter != nil {
return
@@ -99,6 +101,7 @@ func NewUserRegisterCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewSeqGetSuccessCounter() {
if SeqGetSuccessCounter != nil {
return
@@ -109,6 +112,7 @@ func NewSeqGetSuccessCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewSeqGetFailedCounter() {
if SeqGetFailedCounter != nil {
return
@@ -119,6 +123,7 @@ func NewSeqGetFailedCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewSeqSetSuccessCounter() {
if SeqSetSuccessCounter != nil {
return
@@ -129,6 +134,7 @@ func NewSeqSetSuccessCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewSeqSetFailedCounter() {
if SeqSetFailedCounter != nil {
return
@@ -139,6 +145,7 @@ func NewSeqSetFailedCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewApiRequestCounter() {
if ApiRequestCounter != nil {
return
@@ -149,6 +156,7 @@ func NewApiRequestCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewApiRequestSuccessCounter() {
if ApiRequestSuccessCounter != nil {
return
@@ -159,6 +167,7 @@ func NewApiRequestSuccessCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewApiRequestFailedCounter() {
if ApiRequestFailedCounter != nil {
return
@@ -169,6 +178,7 @@ func NewApiRequestFailedCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewGrpcRequestCounter() {
if GrpcRequestCounter != nil {
return
@@ -179,6 +189,7 @@ func NewGrpcRequestCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewGrpcRequestSuccessCounter() {
if GrpcRequestSuccessCounter != nil {
return
@@ -189,6 +200,7 @@ func NewGrpcRequestSuccessCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewGrpcRequestFailedCounter() {
if GrpcRequestFailedCounter != nil {
return
@@ -199,6 +211,7 @@ func NewGrpcRequestFailedCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewSendMsgCount() {
if SendMsgCounter != nil {
return
@@ -209,6 +222,7 @@ func NewSendMsgCount() {
})
}
//nolint:promlinter //no idea to fix it
func NewMsgInsertRedisSuccessCounter() {
if MsgInsertRedisSuccessCounter != nil {
return
@@ -219,6 +233,7 @@ func NewMsgInsertRedisSuccessCounter() {
})
}
//nolint:promlinter //no idea to fix its
func NewMsgInsertRedisFailedCounter() {
if MsgInsertRedisFailedCounter != nil {
return
@@ -229,6 +244,7 @@ func NewMsgInsertRedisFailedCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewMsgInsertMongoSuccessCounter() {
if MsgInsertMongoSuccessCounter != nil {
return
@@ -239,6 +255,7 @@ func NewMsgInsertMongoSuccessCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewMsgInsertMongoFailedCounter() {
if MsgInsertMongoFailedCounter != nil {
return
@@ -249,6 +266,7 @@ func NewMsgInsertMongoFailedCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewMsgPullFromRedisSuccessCounter() {
if MsgPullFromRedisSuccessCounter != nil {
return
@@ -259,6 +277,7 @@ func NewMsgPullFromRedisSuccessCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewMsgPullFromRedisFailedCounter() {
if MsgPullFromRedisFailedCounter != nil {
return
@@ -269,6 +288,7 @@ func NewMsgPullFromRedisFailedCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewMsgPullFromMongoSuccessCounter() {
if MsgPullFromMongoSuccessCounter != nil {
return
@@ -279,6 +299,7 @@ func NewMsgPullFromMongoSuccessCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewMsgPullFromMongoFailedCounter() {
if MsgPullFromMongoFailedCounter != nil {
return
@@ -319,6 +340,7 @@ func NewPullMsgBySeqListTotalCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewSingleChatMsgRecvSuccessCounter() {
if SingleChatMsgRecvSuccessCounter != nil {
return
@@ -329,6 +351,7 @@ func NewSingleChatMsgRecvSuccessCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewGroupChatMsgRecvSuccessCounter() {
if GroupChatMsgRecvSuccessCounter != nil {
return
@@ -339,6 +362,7 @@ func NewGroupChatMsgRecvSuccessCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewWorkSuperGroupChatMsgRecvSuccessCounter() {
if WorkSuperGroupChatMsgRecvSuccessCounter != nil {
return
@@ -359,6 +383,7 @@ func NewOnlineUserGauges() {
})
}
//nolint:promlinter //no idea to fix it
func NewSingleChatMsgProcessSuccessCounter() {
if SingleChatMsgProcessSuccessCounter != nil {
return
@@ -369,6 +394,7 @@ func NewSingleChatMsgProcessSuccessCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewSingleChatMsgProcessFailedCounter() {
if SingleChatMsgProcessFailedCounter != nil {
return
@@ -379,6 +405,7 @@ func NewSingleChatMsgProcessFailedCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewGroupChatMsgProcessSuccessCounter() {
if GroupChatMsgProcessSuccessCounter != nil {
return
@@ -389,6 +416,7 @@ func NewGroupChatMsgProcessSuccessCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewGroupChatMsgProcessFailedCounter() {
if GroupChatMsgProcessFailedCounter != nil {
return
@@ -399,6 +427,7 @@ func NewGroupChatMsgProcessFailedCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewWorkSuperGroupChatMsgProcessSuccessCounter() {
if WorkSuperGroupChatMsgProcessSuccessCounter != nil {
return
@@ -409,6 +438,7 @@ func NewWorkSuperGroupChatMsgProcessSuccessCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewWorkSuperGroupChatMsgProcessFailedCounter() {
if WorkSuperGroupChatMsgProcessFailedCounter != nil {
return
@@ -419,6 +449,7 @@ func NewWorkSuperGroupChatMsgProcessFailedCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewMsgOnlinePushSuccessCounter() {
if MsgOnlinePushSuccessCounter != nil {
return
@@ -429,6 +460,7 @@ func NewMsgOnlinePushSuccessCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewMsgOfflinePushSuccessCounter() {
if MsgOfflinePushSuccessCounter != nil {
return
@@ -439,6 +471,7 @@ func NewMsgOfflinePushSuccessCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewMsgOfflinePushFailedCounter() {
if MsgOfflinePushFailedCounter != nil {
return
@@ -449,6 +482,7 @@ func NewMsgOfflinePushFailedCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewConversationCreateSuccessCounter() {
if ConversationCreateSuccessCounter != nil {
return
@@ -459,6 +493,7 @@ func NewConversationCreateSuccessCounter() {
})
}
//nolint:promlinter //no idea to fix it
func NewConversationCreateFailedCounter() {
if ConversationCreateFailedCounter != nil {
return
+4
View File
@@ -30,13 +30,16 @@ func StartPrometheusSrv(prometheusPort int) error {
if config.Config.Prometheus.Enable {
http.Handle("/metrics", promhttp.Handler())
err := http.ListenAndServe(":"+strconv.Itoa(prometheusPort), nil)
return err
}
return nil
}
func PrometheusHandler() gin.HandlerFunc {
h := promhttp.Handler()
return func(c *gin.Context) {
h.ServeHTTP(c.Writer, c.Request)
}
@@ -49,6 +52,7 @@ type responseBodyWriter struct {
func (r responseBodyWriter) Write(b []byte) (int, error) {
r.body.Write(b)
return r.ResponseWriter.Write(b)
}