Skip to content

Commit

Permalink
fix typo & more comments to make golint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
lewgun authored and lonng committed Aug 15, 2017
1 parent 7146b5e commit d081e0d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions group.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (c *Group) Members() []int64 {
return members
}

// Push message to partial client, which filter return true
// Multicast push the message to the filtered clients
func (c *Group) Multicast(route string, v interface{}, filter SessionFilter) error {
if c.isClosed() {
return ErrClosedGroup
Expand Down Expand Up @@ -112,7 +112,7 @@ func (c *Group) Multicast(route string, v interface{}, filter SessionFilter) err
return nil
}

// Push message to all client
// Broadcast push the message(s) to all members
func (c *Group) Broadcast(route string, v interface{}) error {
if c.isClosed() {
return ErrClosedGroup
Expand Down
12 changes: 6 additions & 6 deletions handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ type (
component.Base
}

JsonMessage struct {
JSONMessage struct {
Code int `json:"code"`
Data string `json:"data"`
}
Expand All @@ -95,7 +95,7 @@ func (m *ProtoMessage) Reset() { *m = ProtoMessage{} }
func (m *ProtoMessage) String() string { return proto.CompactTextString(m) }
func (*ProtoMessage) ProtoMessage() {}

func (t *TestComp) HandleJson(s *session.Session, m *JsonMessage) error {
func (t *TestComp) HandleJSON(s *session.Session, m *JSONMessage) error {
return nil
}

Expand All @@ -111,14 +111,14 @@ func TestHandlerCallJSON(t *testing.T) {
SetSerializer(json.NewSerializer())
handler.register(&TestComp{})

m := JsonMessage{Code: 1, Data: "hello world"}
m := JSONMessage{Code: 1, Data: "hello world"}
data, err := serializeOrRaw(m)
if err != nil {
t.Fail()
}

msg := message.New()
msg.Route = "TestComp.HandleJson"
msg.Route = "TestComp.HandleJSON"
msg.Type = message.Request
msg.Data = data

Expand Down Expand Up @@ -149,14 +149,14 @@ func BenchmarkHandlerCallJSON(b *testing.B) {
SetSerializer(json.NewSerializer())
handler.register(&TestComp{})

m := JsonMessage{Code: 1, Data: "hello world"}
m := JSONMessage{Code: 1, Data: "hello world"}
data, err := serializeOrRaw(m)
if err != nil {
b.Fail()
}

msg := message.New()
msg.Route = "TestComp.HandleJson"
msg.Route = "TestComp.HandleJSON"
msg.Type = message.Request
msg.Data = data

Expand Down
2 changes: 1 addition & 1 deletion interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func EnableDebug() {
env.debug = true
}

// Callback when session closed
// OnSessionClosed set the Callback which will be called when session is closed
// Waring: session has closed,
func OnSessionClosed(cb SessionClosedHandler) {
env.muCallbacks.Lock()
Expand Down
1 change: 1 addition & 0 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
)

//Logger represents the log interface
type Logger interface {
Println(v ...interface{})
Fatal(v ...interface{})
Expand Down
4 changes: 2 additions & 2 deletions timer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var (

// timerManager manager for all timers
timerManager = &struct {
incrementId int64 // auto increment id
incrementID int64 // auto increment id
timers map[int64]*Timer // all timers
chClosingTimer chan int64 // timer for closing
chCreatedTimer chan *Timer
Expand Down Expand Up @@ -135,7 +135,7 @@ func NewCountTimer(interval time.Duration, count int, fn TimerFunc) *Timer {
panic("non-positive interval for NewTimer")
}

id := atomic.AddInt64(&timerManager.incrementId, 1)
id := atomic.AddInt64(&timerManager.incrementID, 1)
t := &Timer{
id: id,
fn: fn,
Expand Down

0 comments on commit d081e0d

Please sign in to comment.