mirror of
https://github.com/pion/webrtc.git
synced 2025-10-06 23:52:51 +08:00
Linter fixes
Disable funlen and some fixes Co-authored-by: Sean DuBois <sean@siobud.com>
This commit is contained in:

committed by
Sean DuBois

parent
a595db7fcc
commit
6997cc792c
@@ -9,6 +9,7 @@ linters:
|
|||||||
disable:
|
disable:
|
||||||
- maligned
|
- maligned
|
||||||
- lll
|
- lll
|
||||||
|
- funlen
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
exclude-use-default: false
|
exclude-use-default: false
|
||||||
|
@@ -25,8 +25,8 @@ install:
|
|||||||
- export PATH=$GOROOT/bin:$PATH
|
- export PATH=$GOROOT/bin:$PATH
|
||||||
- go version
|
- go version
|
||||||
- go env
|
- go env
|
||||||
- go get -u github.com/matoous/godox
|
- go get -u github.com/sean-der/godox
|
||||||
- GO111MODULE=off go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
|
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.18.0
|
||||||
# Install Node 11 (required for WASM tests)
|
# Install Node 11 (required for WASM tests)
|
||||||
- wget https://raw.githubusercontent.com/creationix/nvm/v0.31.0/nvm.sh -O ~/.nvm/nvm.sh
|
- wget https://raw.githubusercontent.com/creationix/nvm/v0.31.0/nvm.sh -O ~/.nvm/nvm.sh
|
||||||
- source ~/.nvm/nvm.sh
|
- source ~/.nvm/nvm.sh
|
||||||
|
@@ -114,7 +114,6 @@ func mustSignalViaHTTP(address string) (offerOut chan webrtc.SessionDescription,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
@@ -111,7 +111,6 @@ func main() {
|
|||||||
fmt.Println("Ctrl+C the remote client to stop the demo")
|
fmt.Println("Ctrl+C the remote client to stop the demo")
|
||||||
} else if connectionState == webrtc.ICEConnectionStateFailed ||
|
} else if connectionState == webrtc.ICEConnectionStateFailed ||
|
||||||
connectionState == webrtc.ICEConnectionStateDisconnected {
|
connectionState == webrtc.ICEConnectionStateDisconnected {
|
||||||
|
|
||||||
closeErr := oggFile.Close()
|
closeErr := oggFile.Close()
|
||||||
if closeErr != nil {
|
if closeErr != nil {
|
||||||
panic(closeErr)
|
panic(closeErr)
|
||||||
@@ -120,7 +119,6 @@ func main() {
|
|||||||
closeErr = ivfFile.Close()
|
closeErr = ivfFile.Close()
|
||||||
if closeErr != nil {
|
if closeErr != nil {
|
||||||
panic(closeErr)
|
panic(closeErr)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("Done writing media files")
|
fmt.Println("Done writing media files")
|
||||||
|
@@ -104,5 +104,4 @@ func (c ICETransportState) toICE() ice.ConnectionState {
|
|||||||
default:
|
default:
|
||||||
return ice.ConnectionState(Unknown)
|
return ice.ConnectionState(Unknown)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -100,5 +100,4 @@ func TestNoEndpoints(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic("Failed to close network pipe")
|
panic("Failed to close network pipe")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,6 @@ func TestCodecRegistration(t *testing.T) {
|
|||||||
for _, f := range testCases {
|
for _, f := range testCases {
|
||||||
_, err := api.mediaEngine.getCodec(f.c)
|
_, err := api.mediaEngine.getCodec(f.c)
|
||||||
assert.Equal(t, f.e, err)
|
assert.Equal(t, f.e, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
_, err := api.mediaEngine.getCodecSDP(sdp.Codec{PayloadType: invalidPT})
|
_, err := api.mediaEngine.getCodecSDP(sdp.Codec{PayloadType: invalidPT})
|
||||||
assert.Equal(t, err, ErrCodecNotFound)
|
assert.Equal(t, err, ErrCodecNotFound)
|
||||||
|
@@ -1061,7 +1061,6 @@ func (pc *PeerConnection) openSRTP() {
|
|||||||
|
|
||||||
for _, media := range pc.RemoteDescription().parsed.MediaDescriptions {
|
for _, media := range pc.RemoteDescription().parsed.MediaDescriptions {
|
||||||
for _, attr := range media.Attributes {
|
for _, attr := range media.Attributes {
|
||||||
|
|
||||||
codecType := NewRTPCodecType(media.MediaName.Media)
|
codecType := NewRTPCodecType(media.MediaName.Media)
|
||||||
if codecType == 0 {
|
if codecType == 0 {
|
||||||
continue
|
continue
|
||||||
@@ -1732,7 +1731,6 @@ func (pc *PeerConnection) newRTPTransceiver(
|
|||||||
direction RTPTransceiverDirection,
|
direction RTPTransceiverDirection,
|
||||||
kind RTPCodecType,
|
kind RTPCodecType,
|
||||||
) *RTPTransceiver {
|
) *RTPTransceiver {
|
||||||
|
|
||||||
t := &RTPTransceiver{
|
t := &RTPTransceiver{
|
||||||
Receiver: receiver,
|
Receiver: receiver,
|
||||||
Sender: sender,
|
Sender: sender,
|
||||||
|
@@ -35,6 +35,7 @@ func (api *API) newPair() (pcOffer *PeerConnection, pcAnswer *PeerConnection, er
|
|||||||
|
|
||||||
return pca, pcb, nil
|
return pca, pcb, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNew_Go(t *testing.T) {
|
func TestNew_Go(t *testing.T) {
|
||||||
api := NewAPI()
|
api := NewAPI()
|
||||||
t.Run("Success", func(t *testing.T) {
|
t.Run("Success", func(t *testing.T) {
|
||||||
@@ -300,7 +301,6 @@ func TestPeerConnection_EventHandlers_Go(t *testing.T) {
|
|||||||
// This test asserts that nothing deadlocks we try to shutdown when DTLS is in flight
|
// This test asserts that nothing deadlocks we try to shutdown when DTLS is in flight
|
||||||
// We ensure that DTLS is in flight by removing the mux func for it, so all inbound DTLS is lost
|
// We ensure that DTLS is in flight by removing the mux func for it, so all inbound DTLS is lost
|
||||||
func TestPeerConnection_ShutdownNoDTLS(t *testing.T) {
|
func TestPeerConnection_ShutdownNoDTLS(t *testing.T) {
|
||||||
|
|
||||||
lim := test.TimeOut(time.Second * 10)
|
lim := test.TimeOut(time.Second * 10)
|
||||||
defer lim.Stop()
|
defer lim.Stop()
|
||||||
|
|
||||||
@@ -458,7 +458,6 @@ func TestPeerConnection_satisfyTypeAndDirection(t *testing.T) {
|
|||||||
t.Errorf("satisfyTypeAndDirection %q: \ngot\n%s \nwant\n%s", test.name, gotStr, wantStr)
|
t.Errorf("satisfyTypeAndDirection %q: \ngot\n%s \nwant\n%s", test.name, gotStr, wantStr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOneAttrKeyConnectionSetupPerMediaDescriptionInSDP(t *testing.T) {
|
func TestOneAttrKeyConnectionSetupPerMediaDescriptionInSDP(t *testing.T) {
|
||||||
|
@@ -72,7 +72,6 @@ func TestSRTPDrainLeak(t *testing.T) {
|
|||||||
if s == DTLSTransportStateConnected {
|
if s == DTLSTransportStateConnected {
|
||||||
close(dtlsConnected)
|
close(dtlsConnected)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
err = signalPair(pcOffer, pcAnswer)
|
err = signalPair(pcOffer, pcAnswer)
|
||||||
@@ -635,7 +634,6 @@ func TestOfferRejectionMissingCodec(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAddTransceiverFromTrackSendOnly(t *testing.T) {
|
func TestAddTransceiverFromTrackSendOnly(t *testing.T) {
|
||||||
|
|
||||||
pc, err := NewPeerConnection(Configuration{})
|
pc, err := NewPeerConnection(Configuration{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err.Error())
|
t.Error(err.Error())
|
||||||
@@ -686,7 +684,6 @@ func TestAddTransceiverFromTrackSendOnly(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAddTransceiverFromTrackSendRecv(t *testing.T) {
|
func TestAddTransceiverFromTrackSendRecv(t *testing.T) {
|
||||||
|
|
||||||
pc, err := NewPeerConnection(Configuration{})
|
pc, err := NewPeerConnection(Configuration{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err.Error())
|
t.Error(err.Error())
|
||||||
@@ -733,7 +730,6 @@ func TestAddTransceiverFromTrackSendRecv(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAddTransceiver(t *testing.T) {
|
func TestAddTransceiver(t *testing.T) {
|
||||||
|
|
||||||
pc, err := NewPeerConnection(Configuration{})
|
pc, err := NewPeerConnection(Configuration{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err.Error())
|
t.Error(err.Error())
|
||||||
@@ -765,7 +761,6 @@ func TestAddTransceiver(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAddTransceiverFromKind(t *testing.T) {
|
func TestAddTransceiverFromKind(t *testing.T) {
|
||||||
|
|
||||||
pc, err := NewPeerConnection(Configuration{})
|
pc, err := NewPeerConnection(Configuration{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err.Error())
|
t.Error(err.Error())
|
||||||
@@ -797,7 +792,6 @@ func TestAddTransceiverFromKind(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAddTransceiverFromKindFailsSendOnly(t *testing.T) {
|
func TestAddTransceiverFromKindFailsSendOnly(t *testing.T) {
|
||||||
|
|
||||||
pc, err := NewPeerConnection(Configuration{})
|
pc, err := NewPeerConnection(Configuration{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err.Error())
|
t.Error(err.Error())
|
||||||
@@ -815,7 +809,6 @@ func TestAddTransceiverFromKindFailsSendOnly(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAddTransceiverFromTrackFailsRecvOnly(t *testing.T) {
|
func TestAddTransceiverFromTrackFailsRecvOnly(t *testing.T) {
|
||||||
|
|
||||||
pc, err := NewPeerConnection(Configuration{})
|
pc, err := NewPeerConnection(Configuration{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err.Error())
|
t.Error(err.Error())
|
||||||
|
@@ -21,7 +21,6 @@ type ivfWriterPacketTest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestIVFWriter_AddPacketAndClose(t *testing.T) {
|
func TestIVFWriter_AddPacketAndClose(t *testing.T) {
|
||||||
|
|
||||||
rawPkt := []byte{
|
rawPkt := []byte{
|
||||||
0x90, 0xe0, 0x69, 0x8f, 0xd9, 0xc2, 0x93, 0xda, 0x1c, 0x64,
|
0x90, 0xe0, 0x69, 0x8f, 0xd9, 0xc2, 0x93, 0xda, 0x1c, 0x64,
|
||||||
0x27, 0x82, 0x00, 0x01, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x98, 0x36, 0xbe, 0x88, 0x9e,
|
0x27, 0x82, 0x00, 0x01, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x98, 0x36, 0xbe, 0x88, 0x9e,
|
||||||
|
@@ -36,7 +36,6 @@ func (s *SampleBuilder) Push(p *rtp.Packet) {
|
|||||||
s.buffer[p.SequenceNumber] = p
|
s.buffer[p.SequenceNumber] = p
|
||||||
s.lastPush = p.SequenceNumber
|
s.lastPush = p.SequenceNumber
|
||||||
s.buffer[p.SequenceNumber-s.maxLate] = nil
|
s.buffer[p.SequenceNumber-s.maxLate] = nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have a valid collection of RTP Packets
|
// We have a valid collection of RTP Packets
|
||||||
|
@@ -78,7 +78,6 @@ func (t *QUICTransport) GetLocalParameters() (QUICParameters, error) {
|
|||||||
prints, err := c.GetFingerprints()
|
prints, err := c.GetFingerprints()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return QUICParameters{}, err
|
return QUICParameters{}, err
|
||||||
|
|
||||||
}
|
}
|
||||||
fingerprints = append(fingerprints, prints...)
|
fingerprints = append(fingerprints, prints...)
|
||||||
}
|
}
|
||||||
|
@@ -71,7 +71,6 @@ func TestNewTracks(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("Failed to new video track")
|
t.Error("Failed to new video track")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNewTracksWrite(t *testing.T) {
|
func TestNewTracksWrite(t *testing.T) {
|
||||||
@@ -115,5 +114,4 @@ func TestNewTracksWrite(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("Failed to write to audio track")
|
t.Error("Failed to write to audio track")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user