Fix golint warnings (#4241)

Include:
1. plugin/forward/type.go:8:2: const typeUdp should be typeUDP
2. plugin/forward/type.go:9:2: const typeTcp should be typeTCP
3. plugin/forward/type.go:10:2: const typeTls should be typeTLS
4. plugin/kubernetes/metrics.go:24:2: var DnsProgrammingLatency should be DNSProgrammingLatency
5. plugin/kubernetes/metrics_test.go:124:102: func parameter clusterIp should be clusterIP

Signed-off-by: zouyu <zouy.fnst@cn.fujitsu.com>
This commit is contained in:
ZouYu
2020-10-28 14:39:56 +08:00
committed by GitHub
parent d6660f369e
commit c58e4b09fc
4 changed files with 21 additions and 21 deletions

View File

@@ -96,14 +96,14 @@ func TestCleanupAll(t *testing.T) {
c2, _ := dns.DialTimeout("udp", tr.addr, maxDialTimeout)
c3, _ := dns.DialTimeout("udp", tr.addr, maxDialTimeout)
tr.conns[typeUdp] = []*persistConn{{c1, time.Now()}, {c2, time.Now()}, {c3, time.Now()}}
tr.conns[typeUDP] = []*persistConn{{c1, time.Now()}, {c2, time.Now()}, {c3, time.Now()}}
if len(tr.conns[typeUdp]) != 3 {
if len(tr.conns[typeUDP]) != 3 {
t.Error("Expected 3 connections")
}
tr.cleanup(true)
if len(tr.conns[typeUdp]) > 0 {
if len(tr.conns[typeUDP]) > 0 {
t.Error("Expected no cached connections")
}
}

View File

@@ -5,33 +5,33 @@ import "net"
type transportType int
const (
typeUdp transportType = iota
typeTcp
typeTls
typeUDP transportType = iota
typeTCP
typeTLS
typeTotalCount // keep this last
)
func stringToTransportType(s string) transportType {
switch s {
case "udp":
return typeUdp
return typeUDP
case "tcp":
return typeTcp
return typeTCP
case "tcp-tls":
return typeTls
return typeTLS
}
return typeUdp
return typeUDP
}
func (t *Transport) transportTypeFromConn(pc *persistConn) transportType {
if _, ok := pc.c.Conn.(*net.UDPConn); ok {
return typeUdp
return typeUDP
}
if t.tlsConfig == nil {
return typeTcp
return typeTCP
}
return typeTls
return typeTLS
}