Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
golangci-lint upgrade to v1.56.2 added more checks

Relates to pion/.goassets#201
  • Loading branch information
Sean-Der committed Mar 17, 2024
1 parent 99f146f commit b71802f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions vnet/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestUDPConn(t *testing.T) {
conn.readCh <- chunk // echo back
return nil
},
onOnClosed: func(addr net.Addr) {
onOnClosed: func(net.Addr) {
atomic.AddInt32(&nClosed, 1)
},
}
Expand Down Expand Up @@ -143,7 +143,7 @@ func TestUDPConn(t *testing.T) {
conn.readCh <- chunk // echo back
return nil
},
onOnClosed: func(addr net.Addr) {
onOnClosed: func(net.Addr) {
atomic.AddInt32(&nClosed, 1)
},
}
Expand Down Expand Up @@ -204,7 +204,7 @@ func TestUDPConn(t *testing.T) {
Port: 1234,
}
obs := &dummyObserver{
onOnClosed: func(addr net.Addr) {
onOnClosed: func(net.Addr) {
atomic.AddInt32(&nClosed, 1)
},
}
Expand Down
2 changes: 1 addition & 1 deletion vnet/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ func TestRouterDelay(t *testing.T) {
var delayRes []time.Duration
nPkts := 1

nic[0].onInboundChunkHandler = func(c Chunk) {}
nic[0].onInboundChunkHandler = func(Chunk) {}

nic[1].onInboundChunkHandler = func(c Chunk) {
delay := time.Since(c.getTimestamp())
Expand Down
2 changes: 1 addition & 1 deletion vnet/udpproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func NewProxy(router *Router) (*UDPProxy, error) {

// Close the proxy, stop all workers.
func (v *UDPProxy) Close() error {
v.workers.Range(func(key, value interface{}) bool {
v.workers.Range(func(_, value interface{}) bool {
_ = value.(*aUDPProxyWorker).Close() //nolint:forcetypeassert
return true
})
Expand Down
2 changes: 1 addition & 1 deletion vnet/udpproxy_direct.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
// Deliver directly send packet to vnet or real-server.
// For example, we can use this API to simulate the REPLAY ATTACK.
func (v *UDPProxy) Deliver(sourceAddr, destAddr net.Addr, b []byte) (nn int, err error) {
v.workers.Range(func(key, value interface{}) bool {
v.workers.Range(func(_, value interface{}) bool {
if nn, err = value.(*aUDPProxyWorker).Deliver(sourceAddr, destAddr, b); err != nil {
return false // Fail, abort.
} else if nn == len(b) {
Expand Down
4 changes: 2 additions & 2 deletions vnet/udpproxy_direct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,9 @@ func TestUDPProxyDirectDeliverBadCase(t *testing.T) {
}

// BadCase: Write on closed socket, error and ignore.
proxy.workers.Range(func(key, value interface{}) bool {
proxy.workers.Range(func(_, value interface{}) bool {
//nolint:forcetypeassert
value.(*aUDPProxyWorker).endpoints.Range(func(key, value interface{}) bool {
value.(*aUDPProxyWorker).endpoints.Range(func(_, value interface{}) bool {
_ = value.(*net.UDPConn).Close() //nolint:forcetypeassert
return true
})
Expand Down

0 comments on commit b71802f

Please sign in to comment.