add golangci-lint linter (#5499)

This commit is contained in:
Ondřej Benkovský
2022-07-10 20:06:33 +02:00
committed by GitHub
parent abc5ac8017
commit c2dbb7141a
104 changed files with 83 additions and 184 deletions

View File

@@ -8,7 +8,6 @@ import (
// ClosestEncloser returns the closest encloser for qname.
func (z *Zone) ClosestEncloser(qname string) (*tree.Elem, bool) {
offset, end := dns.NextLabel(qname, 0)
for !end {
elem, _ := z.Tree.Search(qname)

View File

@@ -10,7 +10,6 @@ import (
// Make sure the external miekg/dns dependency is up to date
func TestInclude(t *testing.T) {
name, rm, err := test.TempFile(".", "foo\tIN\tA\t127.0.0.1\n")
if err != nil {
t.Fatalf("Unable to create tmpfile %q: %s", name, err)

View File

@@ -151,7 +151,6 @@ func (z *Zone) Lookup(ctx context.Context, state request.Request, qname string)
// If we see NS records, it means the name as been delegated, and we should return the delegation.
if nsrrs := elem.Type(dns.TypeNS); nsrrs != nil {
// If the query is specifically for DS and the qname matches the delegated name, we should
// return the DS in the answer section and leave the rest empty, i.e. just continue the loop
// and continue searching.
@@ -179,7 +178,6 @@ func (z *Zone) Lookup(ctx context.Context, state request.Request, qname string)
// Found entire name.
if found && shot {
if rrs := elem.Type(dns.TypeCNAME); len(rrs) > 0 && qtype != dns.TypeCNAME {
ctx = context.WithValue(ctx, dnsserver.LoopKey{}, loop+1)
return z.externalLookup(ctx, state, elem, rrs)
@@ -208,7 +206,6 @@ func (z *Zone) Lookup(ctx context.Context, state request.Request, qname string)
}
return rrs, ap.ns(do), additional, Success
}
// Haven't found the original name.
@@ -248,7 +245,6 @@ func (z *Zone) Lookup(ctx context.Context, state request.Request, qname string)
sigs := wildElem.TypeForWildcard(dns.TypeRRSIG, qname)
sigs = rrutil.SubTypeSignature(sigs, qtype)
rrs = append(rrs, sigs...)
}
return rrs, auth, nil, Success
}
@@ -290,7 +286,6 @@ func (z *Zone) Lookup(ctx context.Context, state request.Request, qname string)
}
}
}
}
Out:
return nil, ret, nil, rcode
@@ -325,7 +320,6 @@ func (a Apex) ns(do bool) []dns.RR {
// externalLookup adds signatures and tries to resolve CNAMEs that point to external names.
func (z *Zone) externalLookup(ctx context.Context, state request.Request, elem *tree.Elem, rrs []dns.RR) ([]dns.RR, []dns.RR, []dns.RR, Result) {
qtype := state.QType()
do := state.Do()

View File

@@ -183,7 +183,6 @@ Restart:
retryTicker.Stop()
expireTicker.Stop()
goto Restart
}
}
}
@@ -192,7 +191,6 @@ Restart:
func jitter(n int) time.Duration {
r := rand.Intn(n)
return time.Duration(r) * time.Millisecond
}
// MaxSerialIncrement is the maximum difference between two serial numbers. If the difference between

View File

@@ -139,7 +139,6 @@ func fileParse(c *caddy.Controller) (Zones, error) {
return Zones{}, plugin.Error("file", openErr)
}
log.Warningf("Failed to open %q: trying again in %s", openErr, reload)
}
return Zones{Z: z, Names: names}, nil
}

View File

@@ -75,7 +75,6 @@ Tests:
}
continue Tests
}
}
}
}