fix: add go format

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
pull/926/head
Xinwei Xiong(cubxxw-openim) 2 years ago
parent 4b8cd76ad0
commit 0a27b6e0a6
No known key found for this signature in database
GPG Key ID: 1BAD6F395338EFDE

@ -72,6 +72,7 @@ func newContext(respWriter http.ResponseWriter, req *http.Request) *UserConnCont
ConnID: utils.Md5(req.RemoteAddr + "_" + strconv.Itoa(int(utils.GetCurrentTimestampByMill()))), ConnID: utils.Md5(req.RemoteAddr + "_" + strconv.Itoa(int(utils.GetCurrentTimestampByMill()))),
} }
} }
func newTempContext() *UserConnContext { func newTempContext() *UserConnContext {
return &UserConnContext{ return &UserConnContext{
Req: &http.Request{URL: &url.URL{}}, Req: &http.Request{URL: &url.URL{}},
@ -125,9 +126,11 @@ func (c *UserConnContext) GetOperationID() string {
func (c *UserConnContext) SetOperationID(operationID string) { func (c *UserConnContext) SetOperationID(operationID string) {
c.Req.URL.Query().Set(OperationID, operationID) c.Req.URL.Query().Set(OperationID, operationID)
} }
func (c *UserConnContext) GetToken() string { func (c *UserConnContext) GetToken() string {
return c.Req.URL.Query().Get(Token) return c.Req.URL.Query().Get(Token)
} }
func (c *UserConnContext) SetToken(token string) { func (c *UserConnContext) SetToken(token string) {
c.Req.URL.RawQuery = Token + "=" + token c.Req.URL.RawQuery = Token + "=" + token
} }

@ -197,8 +197,10 @@ func (ws *WsServer) sendUserOnlineInfoToOtherNode(ctx context.Context, client *C
continue continue
} }
msgClient := msggateway.NewMsgGatewayClient(v) msgClient := msggateway.NewMsgGatewayClient(v)
_, err := msgClient.MultiTerminalLoginCheck(ctx, &msggateway.MultiTerminalLoginCheckReq{UserID: client.UserID, _, err := msgClient.MultiTerminalLoginCheck(ctx, &msggateway.MultiTerminalLoginCheckReq{
PlatformID: int32(client.PlatformID), Token: client.token}) UserID: client.UserID,
PlatformID: int32(client.PlatformID), Token: client.token,
})
if err != nil { if err != nil {
log.ZWarn(ctx, "MultiTerminalLoginCheck err", err, "node", v.Target()) log.ZWarn(ctx, "MultiTerminalLoginCheck err", err, "node", v.Target())
continue continue
@ -206,6 +208,7 @@ func (ws *WsServer) sendUserOnlineInfoToOtherNode(ctx context.Context, client *C
} }
return nil return nil
} }
func (ws *WsServer) SetKickHandlerInfo(i *kickHandler) { func (ws *WsServer) SetKickHandlerInfo(i *kickHandler) {
ws.kickHandlerChan <- i ws.kickHandlerChan <- i
} }

@ -25,11 +25,12 @@ var (
addr = "127.0.0.1:9092" addr = "127.0.0.1:9092"
) )
var consumer sarama.Consumer var (
var producer sarama.SyncProducer consumer sarama.Consumer
producer sarama.SyncProducer
)
func init() { func init() {
//Producer //Producer
config := sarama.NewConfig() // Instantiate a sarama Config config := sarama.NewConfig() // Instantiate a sarama Config
config.Producer.Return.Successes = true // Whether to enable the successes channel to be notified after the message is sent successfully config.Producer.Return.Successes = true // Whether to enable the successes channel to be notified after the message is sent successfully
@ -43,7 +44,7 @@ func init() {
} }
producer = client producer = client
//Consumer // Consumer
consumerT, err := sarama.NewConsumer([]string{addr}, sarama.NewConfig()) consumerT, err := sarama.NewConsumer([]string{addr}, sarama.NewConfig())
if err != nil { if err != nil {
fmt.Printf("fail to start consumer, err:%v\n", err) fmt.Printf("fail to start consumer, err:%v\n", err)

@ -158,7 +158,7 @@ func GroupConversion() {
temp := time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC) temp := time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC)
if val.NotificationUpdateTime.Equal(temp) { if val.NotificationUpdateTime.Equal(temp) {
results[i].NotificationUpdateTime = time.Now() results[i].NotificationUpdateTime = time.Now()
//fmt.Println(val.NotificationUpdateTime) // fmt.Println(val.NotificationUpdateTime)
} }
} }
// Process query results // Process query results
@ -220,7 +220,7 @@ func ChatLogsConversion() {
MysqlDb_v2.Limit(batchSize).Offset(offset).Find(&results) MysqlDb_v2.Limit(batchSize).Offset(offset).Find(&results)
// Process query results // Process query results
fmt.Println("============================batch data===================", offset, batchSize) fmt.Println("============================batch data===================", offset, batchSize)
//fmt.Println(results) // fmt.Println(results)
MysqlDb_v3.Create(results) MysqlDb_v3.Create(results)
fmt.Println("======================================================") fmt.Println("======================================================")
offset += batchSize offset += batchSize

@ -17,8 +17,9 @@ package main
import ( import (
"testing" "testing"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
) )
func TestCheckMysql(t *testing.T) { func TestCheckMysql(t *testing.T) {

@ -19,11 +19,13 @@ import (
"io" "io"
"os" "os"
"github.com/OpenIMSDK/Open-IM-Server/tools/imctl/pkg/cli/genericclioptions"
cliflag "github.com/openimsdk/component-base/pkg/cli/flag" cliflag "github.com/openimsdk/component-base/pkg/cli/flag"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/OpenIMSDK/Open-IM-Server/tools/imctl/pkg/cli/genericclioptions"
cmdutil "github.com/OpenIMSDK/Open-IM-Server/tools/imctl/inernal/iamctl/cmd/util"
"github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/cmd/color" "github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/cmd/color"
"github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/cmd/completion" "github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/cmd/completion"
"github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/cmd/info" "github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/cmd/info"
@ -34,7 +36,6 @@ import (
"github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/cmd/secret" "github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/cmd/secret"
"github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/cmd/set" "github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/cmd/set"
"github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/cmd/user" "github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/cmd/user"
cmdutil "github.com/OpenIMSDK/Open-IM-Server/tools/imctl/inernal/iamctl/cmd/util"
"github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/cmd/validate" "github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/cmd/validate"
"github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/cmd/version" "github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/cmd/version"
"github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/util/templates" "github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/util/templates"

@ -48,13 +48,13 @@ Find more information at:
colorExample = templates.Examples(` colorExample = templates.Examples(`
# Print supported foreground and background colors # Print supported foreground and background colors
iamctl color imctl color
# Print supported colors by type # Print supported colors by type
iamctl color -t fg-hi imctl color -t fg-hi
# Print all supported colors # Print all supported colors
iamctl color -t all`) imctl color -t all`)
availableTypes = []string{"fg", "fg-hi", "bg", "bg-hi", "base", "all"} availableTypes = []string{"fg", "fg-hi", "bg", "bg-hi", "base", "all"}

@ -22,10 +22,11 @@ import (
"github.com/golang-jwt/jwt/v4" "github.com/golang-jwt/jwt/v4"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/marmotedu/iam/internal/pkg/middleware/auth"
cmdutil "github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/cmd/util" cmdutil "github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/cmd/util"
"github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/util/templates" "github.com/OpenIMSDK/Open-IM-Server/tools/imctl/internal/imctl/util/templates"
"github.com/OpenIMSDK/Open-IM-Server/tools/imctl/pkg/cli/genericclioptions" "github.com/OpenIMSDK/Open-IM-Server/tools/imctl/pkg/cli/genericclioptions"
"github.com/marmotedu/iam/internal/pkg/middleware/auth"
) )
const ( const (

@ -68,4 +68,4 @@ func TestGetConfigValue(t *testing.T) {
} }
}) })
} }
} }

Loading…
Cancel
Save