Linter fixes

Disable funlen and some fixes

Co-authored-by: Sean DuBois <sean@siobud.com>
This commit is contained in:
Hugo Arregui
2019-09-10 21:48:14 -03:00
committed by Sean DuBois
parent a595db7fcc
commit 6997cc792c
14 changed files with 4 additions and 24 deletions

View File

@@ -9,6 +9,7 @@ linters:
disable:
- maligned
- lll
- funlen
issues:
exclude-use-default: false

View File

@@ -25,8 +25,8 @@ install:
- export PATH=$GOROOT/bin:$PATH
- go version
- go env
- go get -u github.com/matoous/godox
- GO111MODULE=off go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
- go get -u github.com/sean-der/godox
- 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)
- wget https://raw.githubusercontent.com/creationix/nvm/v0.31.0/nvm.sh -O ~/.nvm/nvm.sh
- source ~/.nvm/nvm.sh

View File

@@ -114,7 +114,6 @@ func mustSignalViaHTTP(address string) (offerOut chan webrtc.SessionDescription,
if err != nil {
panic(err)
}
})
go func() {

View File

@@ -111,7 +111,6 @@ func main() {
fmt.Println("Ctrl+C the remote client to stop the demo")
} else if connectionState == webrtc.ICEConnectionStateFailed ||
connectionState == webrtc.ICEConnectionStateDisconnected {
closeErr := oggFile.Close()
if closeErr != nil {
panic(closeErr)
@@ -120,7 +119,6 @@ func main() {
closeErr = ivfFile.Close()
if closeErr != nil {
panic(closeErr)
}
fmt.Println("Done writing media files")

View File

@@ -104,5 +104,4 @@ func (c ICETransportState) toICE() ice.ConnectionState {
default:
return ice.ConnectionState(Unknown)
}
}

View File

@@ -100,5 +100,4 @@ func TestNoEndpoints(t *testing.T) {
if err != nil {
panic("Failed to close network pipe")
}
}

View File

@@ -30,7 +30,6 @@ func TestCodecRegistration(t *testing.T) {
for _, f := range testCases {
_, err := api.mediaEngine.getCodec(f.c)
assert.Equal(t, f.e, err)
}
_, err := api.mediaEngine.getCodecSDP(sdp.Codec{PayloadType: invalidPT})
assert.Equal(t, err, ErrCodecNotFound)

View File

@@ -1061,7 +1061,6 @@ func (pc *PeerConnection) openSRTP() {
for _, media := range pc.RemoteDescription().parsed.MediaDescriptions {
for _, attr := range media.Attributes {
codecType := NewRTPCodecType(media.MediaName.Media)
if codecType == 0 {
continue
@@ -1732,7 +1731,6 @@ func (pc *PeerConnection) newRTPTransceiver(
direction RTPTransceiverDirection,
kind RTPCodecType,
) *RTPTransceiver {
t := &RTPTransceiver{
Receiver: receiver,
Sender: sender,

View File

@@ -35,6 +35,7 @@ func (api *API) newPair() (pcOffer *PeerConnection, pcAnswer *PeerConnection, er
return pca, pcb, nil
}
func TestNew_Go(t *testing.T) {
api := NewAPI()
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
// 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) {
lim := test.TimeOut(time.Second * 10)
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)
}
}
}
func TestOneAttrKeyConnectionSetupPerMediaDescriptionInSDP(t *testing.T) {

View File

@@ -72,7 +72,6 @@ func TestSRTPDrainLeak(t *testing.T) {
if s == DTLSTransportStateConnected {
close(dtlsConnected)
}
})
err = signalPair(pcOffer, pcAnswer)
@@ -635,7 +634,6 @@ func TestOfferRejectionMissingCodec(t *testing.T) {
}
func TestAddTransceiverFromTrackSendOnly(t *testing.T) {
pc, err := NewPeerConnection(Configuration{})
if err != nil {
t.Error(err.Error())
@@ -686,7 +684,6 @@ func TestAddTransceiverFromTrackSendOnly(t *testing.T) {
}
func TestAddTransceiverFromTrackSendRecv(t *testing.T) {
pc, err := NewPeerConnection(Configuration{})
if err != nil {
t.Error(err.Error())
@@ -733,7 +730,6 @@ func TestAddTransceiverFromTrackSendRecv(t *testing.T) {
}
func TestAddTransceiver(t *testing.T) {
pc, err := NewPeerConnection(Configuration{})
if err != nil {
t.Error(err.Error())
@@ -765,7 +761,6 @@ func TestAddTransceiver(t *testing.T) {
}
func TestAddTransceiverFromKind(t *testing.T) {
pc, err := NewPeerConnection(Configuration{})
if err != nil {
t.Error(err.Error())
@@ -797,7 +792,6 @@ func TestAddTransceiverFromKind(t *testing.T) {
}
func TestAddTransceiverFromKindFailsSendOnly(t *testing.T) {
pc, err := NewPeerConnection(Configuration{})
if err != nil {
t.Error(err.Error())
@@ -815,7 +809,6 @@ func TestAddTransceiverFromKindFailsSendOnly(t *testing.T) {
}
func TestAddTransceiverFromTrackFailsRecvOnly(t *testing.T) {
pc, err := NewPeerConnection(Configuration{})
if err != nil {
t.Error(err.Error())

View File

@@ -21,7 +21,6 @@ type ivfWriterPacketTest struct {
}
func TestIVFWriter_AddPacketAndClose(t *testing.T) {
rawPkt := []byte{
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,

View File

@@ -36,7 +36,6 @@ func (s *SampleBuilder) Push(p *rtp.Packet) {
s.buffer[p.SequenceNumber] = p
s.lastPush = p.SequenceNumber
s.buffer[p.SequenceNumber-s.maxLate] = nil
}
// We have a valid collection of RTP Packets

View File

@@ -78,7 +78,6 @@ func (t *QUICTransport) GetLocalParameters() (QUICParameters, error) {
prints, err := c.GetFingerprints()
if err != nil {
return QUICParameters{}, err
}
fingerprints = append(fingerprints, prints...)
}

View File

@@ -71,7 +71,6 @@ func TestNewTracks(t *testing.T) {
if err != nil {
t.Error("Failed to new video track")
}
}
func TestNewTracksWrite(t *testing.T) {
@@ -115,5 +114,4 @@ func TestNewTracksWrite(t *testing.T) {
if err != nil {
t.Error("Failed to write to audio track")
}
}