Upgrade golangci-lint, more linters

Introduces new linters, upgrade golangci-lint to version (v1.63.4)
This commit is contained in:
Joe Turki
2025-01-02 06:04:12 -06:00
parent 99dcc6b7bf
commit feeeebf251
147 changed files with 3842 additions and 2139 deletions

View File

@@ -15,7 +15,8 @@ import (
)
// websocketServer is called for every new inbound WebSocket
func websocketServer(ws *websocket.Conn) { // nolint:gocognit
// nolint: gocognit, cyclop
func websocketServer(wsConn *websocket.Conn) {
// Create a new RTCPeerConnection
peerConnection, err := webrtc.NewPeerConnection(webrtc.Configuration{})
if err != nil {
@@ -26,17 +27,17 @@ func websocketServer(ws *websocket.Conn) { // nolint:gocognit
// ice trickle is implemented. Everytime we have a new candidate available we send
// it as soon as it is ready. We don't wait to emit a Offer/Answer until they are
// all available
peerConnection.OnICECandidate(func(c *webrtc.ICECandidate) {
if c == nil {
peerConnection.OnICECandidate(func(candidate *webrtc.ICECandidate) {
if candidate == nil {
return
}
outbound, marshalErr := json.Marshal(c.ToJSON())
outbound, marshalErr := json.Marshal(candidate.ToJSON())
if marshalErr != nil {
panic(marshalErr)
}
if _, err = ws.Write(outbound); err != nil {
if _, err = wsConn.Write(outbound); err != nil {
panic(err)
}
})
@@ -61,7 +62,7 @@ func websocketServer(ws *websocket.Conn) { // nolint:gocognit
buf := make([]byte, 1500)
for {
// Read each inbound WebSocket Message
n, err := ws.Read(buf)
n, err := wsConn.Read(buf)
if err != nil {
panic(err)
}
@@ -94,7 +95,7 @@ func websocketServer(ws *websocket.Conn) { // nolint:gocognit
panic(marshalErr)
}
if _, err = ws.Write(outbound); err != nil {
if _, err = wsConn.Write(outbound); err != nil {
panic(err)
}
// Attempt to unmarshal as a ICECandidateInit. If the candidate field is empty