Skip to content

Commit 92f772e

Browse files
committed
Misc cleanup
- Fix lint warnings. - Use standard comment format to mark deprecated identifiers. - Remove redundant paragraph from doc.
1 parent f4f69d2 commit 92f772e

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

doc.go

-5
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,6 @@
146146
// CheckOrigin: func(r *http.Request) bool { return true },
147147
// }
148148
//
149-
// We recommend the upgrader.Upgrade method to perform an upgrade
150-
// from an HTTP connection to a websocket connection. This method performs
151-
// origin policy checking using the CheckOrigin field associated with the
152-
// Upgrader instance.
153-
//
154149
// The deprecated package-level Upgrade function does not perform origin
155150
// checking. The application is responsible for checking the Origin header
156151
// before calling the Upgrade function.

json.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ import (
99
"io"
1010
)
1111

12-
// WriteJSON is deprecated, use c.WriteJSON instead.
12+
// WriteJSON writes the JSON encoding of v as a message.
13+
//
14+
// Deprecated: Use c.WriteJSON instead.
1315
func WriteJSON(c *Conn, v interface{}) error {
1416
return c.WriteJSON(v)
1517
}
1618

17-
// WriteJSON writes the JSON encoding of v to the connection.
19+
// WriteJSON writes the JSON encoding of v as a message.
1820
//
1921
// See the documentation for encoding/json Marshal for details about the
2022
// conversion of Go values to JSON.
@@ -31,7 +33,10 @@ func (c *Conn) WriteJSON(v interface{}) error {
3133
return err2
3234
}
3335

34-
// ReadJSON is deprecated, use c.ReadJSON instead.
36+
// ReadJSON reads the next JSON-encoded message from the connection and stores
37+
// it in the value pointed to by v.
38+
//
39+
// Deprecated: Use c.ReadJSON instead.
3540
func ReadJSON(c *Conn, v interface{}) error {
3641
return c.ReadJSON(v)
3742
}

server.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,10 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
228228
return c, nil
229229
}
230230

231-
// Deprecated: Use websocket.Upgrader instead.
232-
//
233231
// Upgrade upgrades the HTTP server connection to the WebSocket protocol.
234232
//
233+
// Deprecated: Use websocket.Upgrader instead.
234+
//
235235
// Upgrade does not perform origin checking. The application is responsible for
236236
// checking the Origin header before calling Upgrade. An example implementation
237237
// of the same origin policy check is:

util.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ func nextTokenOrQuoted(s string) (value string, rest string) {
111111
case escape:
112112
escape = false
113113
p[j] = b
114-
j += 1
114+
j++
115115
case b == '\\':
116116
escape = true
117117
case b == '"':
118118
return string(p[:j]), s[i+1:]
119119
default:
120120
p[j] = b
121-
j += 1
121+
j++
122122
}
123123
}
124124
return "", ""

0 commit comments

Comments
 (0)