mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
add golangci-lint linter (#5499)
This commit is contained in:
@@ -38,7 +38,7 @@ func Split(n *net.IPNet) []string {
|
||||
func nets(network *net.IPNet, newPrefixLen int) []*net.IPNet {
|
||||
prefixLen, _ := network.Mask.Size()
|
||||
maxSubnets := int(math.Exp2(float64(newPrefixLen)) / math.Exp2(float64(prefixLen)))
|
||||
nets := []*net.IPNet{{network.IP, net.CIDRMask(newPrefixLen, 8*len(network.IP))}}
|
||||
nets := []*net.IPNet{{IP: network.IP, Mask: net.CIDRMask(newPrefixLen, 8*len(network.IP))}}
|
||||
|
||||
for i := 1; i < maxSubnets; i++ {
|
||||
next, exceeds := cidr.NextSubnet(nets[len(nets)-1], newPrefixLen)
|
||||
|
||||
@@ -19,7 +19,6 @@ func TestMultiWriteMsg(t *testing.T) {
|
||||
|
||||
if len(record.Msgs) != 2 {
|
||||
t.Fatalf("Expected 2 messages to be written, but instead found %d\n", len(record.Msgs))
|
||||
|
||||
}
|
||||
if record.Len != responseTestMsg.Len()*2 {
|
||||
t.Fatalf("Expected the bytes written counter to be %d, but instead found %d\n", responseTestMsg.Len()*2, record.Len)
|
||||
|
||||
@@ -66,6 +66,5 @@ func TestIsReverse(t *testing.T) {
|
||||
if got != tc.expected {
|
||||
t.Errorf("Test %d, got %d, expected %d for %s", i, got, tc.expected, tc.name)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ func stripZone(host string) string {
|
||||
func HostPortOrFile(s ...string) ([]string, error) {
|
||||
var servers []string
|
||||
for _, h := range s {
|
||||
|
||||
trans, host := Transport(h)
|
||||
|
||||
addr, _, err := net.SplitHostPort(host)
|
||||
|
||||
@@ -32,5 +32,4 @@ func (r *Rand) Perm(n int) []int {
|
||||
v := r.r.Perm(n)
|
||||
r.m.Unlock()
|
||||
return v
|
||||
|
||||
}
|
||||
|
||||
@@ -271,6 +271,7 @@ func (r replacer) Replace(ctx context.Context, state request.Request, rr *dnstes
|
||||
}
|
||||
}
|
||||
s := string(b)
|
||||
//nolint:staticcheck
|
||||
bufPool.Put(b[:0])
|
||||
return s
|
||||
}
|
||||
|
||||
@@ -276,7 +276,6 @@ func BenchmarkReplacer(b *testing.B) {
|
||||
}
|
||||
|
||||
func BenchmarkReplacer_CommonLogFormat(b *testing.B) {
|
||||
|
||||
w := dnstest.NewRecorder(&test.ResponseWriter{})
|
||||
r := new(dns.Msg)
|
||||
r.SetQuestion("example.org.", dns.TypeHINFO)
|
||||
|
||||
Reference in New Issue
Block a user