forked from mirror/websocket
Fix go vet warning
Move variables from example function arguments to package level variables to avoid `go vet` warning.
This commit is contained in:
parent
5c91b59efa
commit
d1d4086b14
|
@ -12,6 +12,11 @@ import (
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
c *websocket.Conn
|
||||||
|
req *http.Request
|
||||||
|
)
|
||||||
|
|
||||||
// The websocket.IsUnexpectedCloseError function is useful for identifying
|
// The websocket.IsUnexpectedCloseError function is useful for identifying
|
||||||
// application and protocol errors.
|
// application and protocol errors.
|
||||||
//
|
//
|
||||||
|
@ -20,7 +25,8 @@ import (
|
||||||
// only expected close message from the client has the code
|
// only expected close message from the client has the code
|
||||||
// websocket.CloseGoingAway. All other other close messages are likely the
|
// websocket.CloseGoingAway. All other other close messages are likely the
|
||||||
// result of an application or protocol error and are logged to aid debugging.
|
// result of an application or protocol error and are logged to aid debugging.
|
||||||
func ExampleIsUnexpectedCloseError(err error, c *websocket.Conn, req *http.Request) {
|
func ExampleIsUnexpectedCloseError() {
|
||||||
|
|
||||||
for {
|
for {
|
||||||
messageType, p, err := c.ReadMessage()
|
messageType, p, err := c.ReadMessage()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue