Skip to content

Commit fda6c4f

Browse files
committed
Fix linter errors
golangci-lint upgrade to v1.56.2 added more checks Relates to pion/.goassets#201
1 parent 936c6e6 commit fda6c4f

26 files changed

+67
-67
lines changed

datachannel_go_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func TestDataChannel_EventHandlers(t *testing.T) {
5252
close(onOpenCalled)
5353
})
5454

55-
dc.OnMessage(func(p DataChannelMessage) {
55+
dc.OnMessage(func(DataChannelMessage) {
5656
close(onMessageCalled)
5757
})
5858

@@ -222,7 +222,7 @@ func TestDataChannelBufferedAmount(t *testing.T) {
222222
}
223223
})
224224

225-
answerDC.OnMessage(func(msg DataChannelMessage) {
225+
answerDC.OnMessage(func(DataChannelMessage) {
226226
atomic.AddUint32(&nAnswerReceived, 1)
227227
})
228228
assert.True(t, answerDC.Ordered(), "Ordered should be set to true")
@@ -259,7 +259,7 @@ func TestDataChannelBufferedAmount(t *testing.T) {
259259
}
260260
})
261261

262-
offerDC.OnMessage(func(msg DataChannelMessage) {
262+
offerDC.OnMessage(func(DataChannelMessage) {
263263
atomic.AddUint32(&nOfferReceived, 1)
264264
})
265265

@@ -309,7 +309,7 @@ func TestDataChannelBufferedAmount(t *testing.T) {
309309
return
310310
}
311311
var nPacketsReceived int
312-
d.OnMessage(func(msg DataChannelMessage) {
312+
d.OnMessage(func(DataChannelMessage) {
313313
nPacketsReceived++
314314

315315
if nPacketsReceived == 10 {
@@ -347,7 +347,7 @@ func TestDataChannelBufferedAmount(t *testing.T) {
347347
}
348348
})
349349

350-
dc.OnMessage(func(msg DataChannelMessage) {
350+
dc.OnMessage(func(DataChannelMessage) {
351351
})
352352

353353
err = signalPair(offerPC, answerPC)

datachannel_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func TestDataChannel_Open(t *testing.T) {
135135
d.OnOpen(func() {
136136
openCalls <- true
137137
})
138-
d.OnMessage(func(msg DataChannelMessage) {
138+
d.OnMessage(func(DataChannelMessage) {
139139
go func() {
140140
// Wait a little bit to ensure all messages are processed.
141141
time.Sleep(100 * time.Millisecond)
@@ -191,7 +191,7 @@ func TestDataChannel_Open(t *testing.T) {
191191
})
192192
assert.NoError(t, err)
193193

194-
answerDC.OnMessage(func(msg DataChannelMessage) {
194+
answerDC.OnMessage(func(DataChannelMessage) {
195195
go func() {
196196
// Wait a little bit to ensure all messages are processed.
197197
time.Sleep(100 * time.Millisecond)
@@ -237,7 +237,7 @@ func TestDataChannel_Send(t *testing.T) {
237237
if d.Label() != expectedLabel {
238238
return
239239
}
240-
d.OnMessage(func(msg DataChannelMessage) {
240+
d.OnMessage(func(DataChannelMessage) {
241241
e := d.Send([]byte("Pong"))
242242
if e != nil {
243243
t.Fatalf("Failed to send string on data channel")
@@ -259,7 +259,7 @@ func TestDataChannel_Send(t *testing.T) {
259259
t.Fatalf("Failed to send string on data channel")
260260
}
261261
})
262-
dc.OnMessage(func(msg DataChannelMessage) {
262+
dc.OnMessage(func(DataChannelMessage) {
263263
done <- true
264264
})
265265

@@ -288,7 +288,7 @@ func TestDataChannel_Send(t *testing.T) {
288288
if d.Label() != expectedLabel {
289289
return
290290
}
291-
d.OnMessage(func(msg DataChannelMessage) {
291+
d.OnMessage(func(DataChannelMessage) {
292292
e := d.Send([]byte("Pong"))
293293
if e != nil {
294294
t.Fatalf("Failed to send string on data channel")
@@ -309,7 +309,7 @@ func TestDataChannel_Send(t *testing.T) {
309309

310310
assert.True(t, dc.Ordered(), "Ordered should be set to true")
311311

312-
dc.OnMessage(func(msg DataChannelMessage) {
312+
dc.OnMessage(func(DataChannelMessage) {
313313
done <- true
314314
})
315315

@@ -477,7 +477,7 @@ func TestDataChannelParameters(t *testing.T) {
477477

478478
t.Fatal("OnDataChannel must not be fired when negotiated == true")
479479
})
480-
offerPC.OnDataChannel(func(d *DataChannel) {
480+
offerPC.OnDataChannel(func(*DataChannel) {
481481
t.Fatal("OnDataChannel must not be fired when negotiated == true")
482482
})
483483

dtlstransport_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,11 @@ func TestPeerConnection_DTLSRoleSettingEngine(t *testing.T) {
130130
report := test.CheckRoutines(t)
131131
defer report()
132132

133-
t.Run("Server", func(t *testing.T) {
133+
t.Run("Server", func(*testing.T) {
134134
runTest(DTLSRoleServer)
135135
})
136136

137-
t.Run("Client", func(t *testing.T) {
137+
t.Run("Client", func(*testing.T) {
138138
runTest(DTLSRoleClient)
139139
})
140140
}

examples/bandwidth-estimation-from-disk/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func main() {
7474
}
7575

7676
estimatorChan := make(chan cc.BandwidthEstimator, 1)
77-
congestionController.OnNewPeerConnection(func(id string, estimator cc.BandwidthEstimator) {
77+
congestionController.OnNewPeerConnection(func(id string, estimator cc.BandwidthEstimator) { //nolint: revive
7878
estimatorChan <- estimator
7979
})
8080

examples/broadcast/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func main() { // nolint:gocognit
8383
localTrackChan := make(chan *webrtc.TrackLocalStaticRTP)
8484
// Set a handler for when a new remote track starts, this just distributes all our packets
8585
// to connected peers
86-
peerConnection.OnTrack(func(remoteTrack *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) {
86+
peerConnection.OnTrack(func(remoteTrack *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) { //nolint: revive
8787
// Create a local track, all our SFU clients will be fed via this track
8888
localTrack, newTrackErr := webrtc.NewTrackLocalStaticRTP(remoteTrack.Codec().RTPCodecCapability, "video", "pion")
8989
if newTrackErr != nil {

examples/pion-to-pion/answer/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func main() { // nolint:gocognit
8080
// A HTTP handler that allows the other Pion instance to send us ICE candidates
8181
// This allows us to add ICE candidates faster, we don't have to wait for STUN or TURN
8282
// candidates which may be slower
83-
http.HandleFunc("/candidate", func(w http.ResponseWriter, r *http.Request) {
83+
http.HandleFunc("/candidate", func(w http.ResponseWriter, r *http.Request) { //nolint: revive
8484
candidate, candidateErr := ioutil.ReadAll(r.Body)
8585
if candidateErr != nil {
8686
panic(candidateErr)
@@ -91,7 +91,7 @@ func main() { // nolint:gocognit
9191
})
9292

9393
// A HTTP handler that processes a SessionDescription given to us from the other Pion process
94-
http.HandleFunc("/sdp", func(w http.ResponseWriter, r *http.Request) {
94+
http.HandleFunc("/sdp", func(w http.ResponseWriter, r *http.Request) { // nolint: revive
9595
sdp := webrtc.SessionDescription{}
9696
if err := json.NewDecoder(r.Body).Decode(&sdp); err != nil {
9797
panic(err)

examples/pion-to-pion/offer/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func main() { //nolint:gocognit
8080
// A HTTP handler that allows the other Pion instance to send us ICE candidates
8181
// This allows us to add ICE candidates faster, we don't have to wait for STUN or TURN
8282
// candidates which may be slower
83-
http.HandleFunc("/candidate", func(w http.ResponseWriter, r *http.Request) {
83+
http.HandleFunc("/candidate", func(w http.ResponseWriter, r *http.Request) { //nolint: revive
8484
candidate, candidateErr := ioutil.ReadAll(r.Body)
8585
if candidateErr != nil {
8686
panic(candidateErr)
@@ -91,7 +91,7 @@ func main() { //nolint:gocognit
9191
})
9292

9393
// A HTTP handler that processes a SessionDescription given to us from the other Pion process
94-
http.HandleFunc("/sdp", func(w http.ResponseWriter, r *http.Request) {
94+
http.HandleFunc("/sdp", func(w http.ResponseWriter, r *http.Request) { //nolint: revive
9595
sdp := webrtc.SessionDescription{}
9696
if sdpErr := json.NewDecoder(r.Body).Decode(&sdp); sdpErr != nil {
9797
panic(sdpErr)

examples/reflect/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func main() {
112112

113113
// Set a handler for when a new remote track starts, this handler copies inbound RTP packets,
114114
// replaces the SSRC and sends them back
115-
peerConnection.OnTrack(func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) {
115+
peerConnection.OnTrack(func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) { //nolint: revive
116116
fmt.Printf("Track has started, of type %d: %s \n", track.PayloadType(), track.Codec().MimeType)
117117
for {
118118
// Read RTP packets being sent to Pion

examples/rtp-forwarder/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func main() {
131131
// Set a handler for when a new remote track starts, this handler will forward data to
132132
// our UDP listeners.
133133
// In your application this is where you would handle/process audio/video
134-
peerConnection.OnTrack(func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) {
134+
peerConnection.OnTrack(func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) { //nolint: revive
135135
// Retrieve udp connection
136136
c, ok := udpConns[track.Kind().String()]
137137
if !ok {

examples/save-to-disk-av1/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func main() {
101101
// Set a handler for when a new remote track starts, this handler saves buffers to disk as
102102
// an ivf file, since we could have multiple video tracks we provide a counter.
103103
// In your application this is where you would handle/process video
104-
peerConnection.OnTrack(func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) {
104+
peerConnection.OnTrack(func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) { //nolint: revive
105105
if strings.EqualFold(track.Codec().MimeType, webrtc.MimeTypeAV1) {
106106
fmt.Println("Got AV1 track, saving to disk as output.ivf")
107107
saveToDisk(ivfFile, track)

0 commit comments

Comments
 (0)