gopherjs / websocket

websocket provides high- and low-level bindings for the browser's WebSocket API.
BSD 3-Clause "New" or "Revised" License
111 stars 25 forks source link

Don't import `fmt` #18

Closed johanbrandhorst closed 7 years ago

johanbrandhorst commented 7 years ago

The only reason to import fmt appears to be because of the following line of code:

return fmt.Sprintf("CloseEvent: (%s) (%d) %s", cleanStmt, e.Code, e.Reason)

This could trivially be replaced by

return "CloseEvent: (" + cleanStmt + ") (" + strconv.Itoa(e.Code) + ") " + e.Reason

This would lead to smaller file sizes for the projects using the websocket bindings.

johanbrandhorst commented 7 years ago

See explanation in #19. Closing this.