Skip to content

Commit

Permalink
feat: optimize openim make lint style format (#1995)
Browse files Browse the repository at this point in the history
* feat: add openim make lint

* feat: add openim make lint

* feat: add openim make lint

* feat: add openim make lint

* feat: add openim make lint
  • Loading branch information
longyuqing112 committed Mar 4, 2024
1 parent 02a3cfb commit 88bcabe
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 15 deletions.
3 changes: 2 additions & 1 deletion internal/msgtransfer/online_history_msg_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ func (och *OnlineHistoryRedisConsumerHandler) toPushTopic(
msgs []*sdkws.MsgData,
) {
for _, v := range msgs {
och.msgDatabase.MsgToPushMQ(ctx, key, conversationID, v)
och.msgDatabase.MsgToPushMQ(ctx, key, conversationID, v) // nolint: errcheck

}
}

Expand Down
1 change: 0 additions & 1 deletion internal/push/offlinepush/fcm/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ func (f *Fcm) Push(ctx context.Context, userIDs []string, title, content string,
response, err := f.fcmMsgCli.SendAll(ctx, messages)
if err != nil {
Fail = Fail + messageCount

Check failure on line 129 in internal/push/offlinepush/fcm/push.go

View workflow job for this annotation

GitHub Actions / lint

SA4006: this value of `Fail` is never used (staticcheck)
// log.Info(operationID, "some token push err", err.Error(), messageCount)
} else {
Success = Success + response.SuccessCount

Check failure on line 131 in internal/push/offlinepush/fcm/push.go

View workflow job for this annotation

GitHub Actions / lint

SA4006: this value of `Success` is never used (staticcheck)
Fail = Fail + response.FailureCount

Check failure on line 132 in internal/push/offlinepush/fcm/push.go

View workflow job for this annotation

GitHub Actions / lint

SA4006: this value of `Fail` is never used (staticcheck)
Expand Down
2 changes: 1 addition & 1 deletion pkg/common/discoveryregister/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,5 @@ func (cli *K8sDR) GetClientLocalConns() map[string][]*grpc.ClientConn {
return nil
}
func (cli *K8sDR) Close() {
return

}
2 changes: 1 addition & 1 deletion pkg/common/kafka/producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func configureProducerAck(p *Producer, ackConfig string) {

// configureCompression configures the message compression type for the producer.
func configureCompression(p *Producer, compressType string) {
var compress sarama.CompressionCodec = sarama.CompressionNone
var compress = sarama.CompressionNone
err := compress.UnmarshalText(bytes.ToLower([]byte(compressType)))
if err != nil {
fmt.Printf("Failed to configure compression: %v\n", err)
Expand Down
14 changes: 14 additions & 0 deletions test/e2e/api/token/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@ type UserRegisterRequest struct {
Users []User `json:"users"`
}

/* func main() {
// Example usage of functions
token, err := GetUserToken("openIM123456")
if err != nil {
log.Fatalf("Error getting user token: %v", err)
}
fmt.Println("Token:", token)
err = RegisterUser(token, "testUserID", "TestNickname", "https://example.com/image.jpg")
if err != nil {
log.Fatalf("Error registering user: %v", err)
}
} */

// GetUserToken requests a user token from the API.
func GetUserToken(userID string) (string, error) {
reqBody := UserTokenRequest{
Expand Down
22 changes: 11 additions & 11 deletions test/e2e/framework/helpers/chat/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,23 @@ func main() {
select {}
}

// // getLatestVersion fetches the latest version number from a given URL.
// func getLatestVersion(url string) (string, error) {
// resp, err := http.Get(url)
// if err != nil {
// return "", err
// }
// defer resp.Body.Close()
// getLatestVersion fetches the latest version number from a given URL.
/* func getLatestVersion(url string) (string, error) {
resp, err := http.Get(url)
if err != nil {
return "", err
}
defer resp.Body.Close()
// location := resp.Header.Get("Location")
// if location == "" {
// return defaultTemplateVersion, nil
// }
// // Extract the version number from the URL
// latestVersion := filepath.Base(location)
// return latestVersion, nil
// }
// Extract the version number from the URL
latestVersion := filepath.Base(location)
return latestVersion, nil
} */

// downloadAndExtract downloads a file from a URL and extracts it to a destination directory.
func downloadAndExtract(url, destDir string) error {
Expand Down

0 comments on commit 88bcabe

Please sign in to comment.