Skip to content

Commit 46c41b3

Browse files
committed
chore: Lint fixes
1 parent a5ca957 commit 46c41b3

File tree

4 files changed

+7
-12
lines changed

4 files changed

+7
-12
lines changed

diff.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func shapeTree(root *html.Node) {
121121
break
122122
}
123123
}
124-
if hasFlag == false {
124+
if !hasFlag {
125125
root.Attr = append(root.Attr, html.Attribute{Key: LiveRendered})
126126
}
127127
}
@@ -168,7 +168,7 @@ func (d *differ) compareNodes(oldNode, newNode *html.Node, followedPath []int) [
168168
d.liveUpdateCheck(newNode, followedPath)
169169

170170
// If nodes at this position are not equal patch a replacement.
171-
if nodeEqual(oldNode, newNode) == false {
171+
if !nodeEqual(oldNode, newNode) {
172172
return append(patches, d.generatePatch(newNode, followedPath, Replace))
173173
}
174174

@@ -301,10 +301,7 @@ func nodeEqual(oldNode *html.Node, newNode *html.Node) bool {
301301
return false
302302
}
303303
// Data check
304-
if strings.TrimSpace(oldNode.Data) != strings.TrimSpace(newNode.Data) {
305-
return false
306-
}
307-
return true
304+
return strings.TrimSpace(oldNode.Data) == strings.TrimSpace(newNode.Data)
308305
}
309306

310307
// generateNodeList create a list of sibling nodes.

event_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func TestEventParams(t *testing.T) {
1515
}
1616

1717
e.Data = []byte("wrong")
18-
p, err = e.Params()
18+
_, err = e.Params()
1919
if err != ErrMessageMalformed {
2020
t.Error("expected ErrMessageMalformed, got", err)
2121
}

handler.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func NewHandler(store SessionStore, configs ...HandlerConfig) (*Handler, error)
9191
Render: func(ctx context.Context, data interface{}) (io.Reader, error) {
9292
return nil, ErrNoRenderer
9393
},
94-
Error: func(ctx context.Context, w http.ResponseWriter, r *http.Request, err error) {
94+
Error: func(_ context.Context, w http.ResponseWriter, _ *http.Request, err error) {
9595
w.WriteHeader(500)
9696
w.Write([]byte(err.Error()))
9797
},
@@ -115,7 +115,7 @@ func NewHandler(store SessionStore, configs ...HandlerConfig) (*Handler, error)
115115
// ServeHTTP serves this handler.
116116
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
117117
if r.URL.Path == "/favicon.ico" {
118-
if h.ignoreFaviconRequest == true {
118+
if h.ignoreFaviconRequest {
119119
w.WriteHeader(404)
120120
return
121121
}
@@ -138,7 +138,6 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
138138

139139
// Upgrade to the webscoket version.
140140
h.serveWS(w, r)
141-
return
142141
}
143142

144143
// Broadcast send a message to all sockets connected to this handler.

pubsub.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (p *PubSub) Subscribe(topic string, h *Handler) {
4747

4848
// This adjusts the handlers broadcast function to publish onto the
4949
// given topic.
50-
h.broadcast = func(ctx context.Context, h *Handler, msg Event) {
50+
h.broadcast = func(ctx context.Context, _ *Handler, msg Event) {
5151
if err := p.transport.Publish(ctx, topic, msg); err != nil {
5252
log.Println("could not publish broadcast:", err)
5353
}
@@ -71,7 +71,6 @@ type TransportMessage struct {
7171
// LocalTransport a pubsub transport that allows handlers to communicate
7272
// locally.
7373
type LocalTransport struct {
74-
ctx context.Context
7574
queue chan TransportMessage
7675
}
7776

0 commit comments

Comments
 (0)