Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yusank committed Jul 13, 2022
1 parent b89d2da commit 59b8465
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tests/client-bench/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func runClient(uid string) {

func messageToRandomClient(uid string) error {
msg := messagev1.SendMessageReq{
FromUser: uid,
ToUser: randomUID(),
From: uid,
To: randomUID(),
ContentType: messagev1.MessageContentType_Text,
Content: randomMsg(20),
}
Expand Down
7 changes: 4 additions & 3 deletions tests/client-gui/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import (
"strings"
"time"

friendpb "github.com/go-goim/api/user/friend/v1"
"github.com/gorilla/websocket"
"github.com/jroimartin/gocui"

friendpb "github.com/go-goim/api/user/friend/v1"

userv1 "github.com/go-goim/api/user/v1"

messagev1 "github.com/go-goim/api/message/v1"
Expand Down Expand Up @@ -291,7 +292,7 @@ func handleConn(conn *websocket.Conn, g *gocui.Gui, dataChan chan []byte) {
case <-ticker.C:
conn.WriteControl(websocket.PingMessage, []byte("ping"), time.Now().Add(time.Second))
case data := <-dataChan:
msg := new(messagev1.BriefMessage)
msg := new(messagev1.Message)
if err := json.Unmarshal(data, msg); err != nil {
logger.Println("unmarshal err:", err)
msg.Content = string(data)
Expand All @@ -305,7 +306,7 @@ func handleConn(conn *websocket.Conn, g *gocui.Gui, dataChan chan []byte) {
return err1
}
fmt.Fprintln(v, "------")
fmt.Fprintf(v, "Receive|From:%s|Tp:%v|Content:%s|Seq:%s\n", msg.GetFromUser(), msg.GetContentType(), msg.GetContent(), msg.GetMsgSeq())
fmt.Fprintf(v, "Receive|From:%s|Tp:%v|Content:%s|Seq:%d\n", msg.GetFrom(), msg.GetContentType(), msg.GetContent(), msg.GetMsgId())
return nil
})

Expand Down
6 changes: 3 additions & 3 deletions tests/client-gui/layout.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ func resetInput(g *gocui.Gui, v *gocui.View) error {
io.Copy(buf, v)
// todo need load friend list then send msg
m := &messagev1.SendMessageReq{
FromUser: curUser.Uid,
ToUser: toUid,
From: curUser.Uid,
To: toUid,
ContentType: 1,
Content: strings.TrimSuffix(buf.String(), "\n"),
}
Expand Down Expand Up @@ -209,7 +209,7 @@ func resetInput(g *gocui.Gui, v *gocui.View) error {
return err1
}
fmt.Fprintln(v, "------")
fmt.Fprintf(v, "Send|From:%v|Tp:%v|Content:%v\n", m.FromUser, m.ContentType, m.Content)
fmt.Fprintf(v, "Send|From:%v|Tp:%v|Content:%v\n", m.From, m.ContentType, m.Content)
return nil
})
return nil
Expand Down

0 comments on commit 59b8465

Please sign in to comment.