From b8eb3d4ec4d428936acec698cf4988f6eb3b6a7b Mon Sep 17 00:00:00 2001 From: Atsushi Watanabe Date: Sun, 12 Jan 2020 10:51:03 +0900 Subject: [PATCH] Upgrade golangci-lint to 1.19.1 Fix whitespace error. Disable dogsled and godox. --- .golangci.yml | 8 +++++--- .travis.yml | 2 +- agent.go | 3 --- agent_test.go | 2 -- candidate_base.go | 1 - gather.go | 2 -- networktype.go | 1 - transport.go | 1 - transport_test.go | 3 --- 9 files changed, 6 insertions(+), 17 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 2c582d9..f9c0f5c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,11 +7,13 @@ linters-settings: linters: enable-all: true disable: + - dogsled + - funlen + - gochecknoglobals + - godox + - interfacer - lll - maligned - - gochecknoglobals - - interfacer - - funlen issues: exclude-use-default: false diff --git a/.travis.yml b/.travis.yml index d830cfa..a02736d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ env: - GO111MODULE=on before_script: - - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.18.0 + - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.19.1 script: - golangci-lint run ./... diff --git a/agent.go b/agent.go index 4cfe3f4..91e1772 100644 --- a/agent.go +++ b/agent.go @@ -537,7 +537,6 @@ func (a *Agent) initExtIPMapping(config *AgentConfig) error { if !candiHostEnabled { return ErrIneffectiveNAT1To1IPMappingHost } - } else if a.extIPMapper.candidateType == CandidateTypeServerReflexive { candiSrflxEnabled := false for _, candiType := range a.candidateTypes { @@ -656,7 +655,6 @@ func (a *Agent) setSelectedPair(p *candidatePair) { func (a *Agent) pingAllCandidates() { for _, p := range a.checklist { - if p.state == CandidatePairStateWaiting { p.state = CandidatePairStateInProgress } else if p.state != CandidatePairStateInProgress { @@ -848,7 +846,6 @@ func (a *Agent) resolveAndAddMulticastCandidate(c *CandidateHost) { }); err != nil { a.log.Warnf("Failed to add mDNS candidate %s: %v", c.Address(), err) return - } } diff --git a/agent_test.go b/agent_test.go index 6be48c3..a360ef3 100644 --- a/agent_test.go +++ b/agent_test.go @@ -657,7 +657,6 @@ func TestInboundValidity(t *testing.T) { assert.NoError(t, a.Close()) }) - } func TestInvalidAgentStarts(t *testing.T) { @@ -1236,7 +1235,6 @@ func TestBindingRequestTimeout(t *testing.T) { // TestAgentCredentials checks if local username fragments and passwords (if set) meet RFC standard // and ensure it's backwards compatible with previous versions of the pion/ice func TestAgentCredentials(t *testing.T) { - // Make sure to pass travis check by disabling the logs log := logging.NewDefaultLoggerFactory() log.DefaultLogLevel = logging.LogLevelDisabled diff --git a/candidate_base.go b/candidate_base.go index 3e93bbf..bd244f9 100644 --- a/candidate_base.go +++ b/candidate_base.go @@ -134,7 +134,6 @@ func handleInboundCandidateMsg(c Candidate, buffer []byte, srcAddr net.Addr, log if _, err := c.agent().buffer.Write(buffer); err != nil { log.Warnf("failed to write packet") } - } // close stops the recvLoop diff --git a/gather.go b/gather.go index ef4dc6e..7d11565 100644 --- a/gather.go +++ b/gather.go @@ -58,7 +58,6 @@ func (a *Agent) localInterfaces(networkTypes []NetworkType) ([]net.IP, error) { ip = addr.IP case *net.IPAddr: ip = addr.IP - } if ip == nil || ip.IsLoopback() { continue @@ -363,7 +362,6 @@ func (a *Agent) gatherCandidatesSrflx(urls []*URL, networkTypes []NetworkType) { } } } - } func (a *Agent) gatherCandidatesRelay(urls []*URL) error { diff --git a/networktype.go b/networktype.go index 48f5cf6..9d97de7 100644 --- a/networktype.go +++ b/networktype.go @@ -117,7 +117,6 @@ func determineNetworkType(network string, ip net.IP) (NetworkType, error) { return NetworkTypeTCP4, nil } return NetworkTypeTCP6, nil - } return NetworkType(0), fmt.Errorf("unable to determine networkType from %s %s", network, ip) diff --git a/transport.go b/transport.go index 4485e91..9468262 100644 --- a/transport.go +++ b/transport.go @@ -66,7 +66,6 @@ func (a *Agent) connect(ctx context.Context, isControlling bool, remoteUfrag, re return &Conn{ agent: a, }, nil - } // Read implements the Conn Read method. diff --git a/transport_test.go b/transport_test.go index 08a5ca6..272255e 100644 --- a/transport_test.go +++ b/transport_test.go @@ -55,7 +55,6 @@ func testTimeout(t *testing.T, c *Conn, timeout time.Duration) { } } t.Fatalf("Connection failed to time out in time.") - } func TestTimeout(t *testing.T) { @@ -104,7 +103,6 @@ func TestReadClosed(t *testing.T) { if err == nil { t.Fatalf("Reading from a closed channel should return an error") } - } func stressDuplex(t *testing.T) { @@ -440,5 +438,4 @@ func TestConnStats(t *testing.T) { // we should never get here. panic(err) } - }