Chore: pass staticcheck

This commit is contained in:
Dreamacro
2020-08-25 22:19:59 +08:00
parent c1b4382fe8
commit 5805334ccd
31 changed files with 72 additions and 99 deletions

View File

@ -55,7 +55,6 @@ func withHosts(hosts *trie.DomainTrie) middleware {
msg.RecursionAvailable = true
w.WriteMsg(msg)
return
}
}
}
@ -99,7 +98,6 @@ func withFakeIP(fakePool *fakeip.Pool) middleware {
msg.RecursionAvailable = true
w.WriteMsg(msg)
return
}
}
}
@ -130,7 +128,6 @@ func withResolver(resolver *Resolver) handler {
msg.SetRcode(r, msg.Rcode)
msg.Authoritative = true
w.WriteMsg(msg)
return
}
}

View File

@ -106,7 +106,7 @@ func (r *Resolver) Exchange(m *D.Msg) (msg *D.Msg, err error) {
setMsgTTL(msg, uint32(1)) // Continue fetch
go r.exchangeWithoutCache(m)
} else {
setMsgTTL(msg, uint32(expireTime.Sub(time.Now()).Seconds()))
setMsgTTL(msg, uint32(time.Until(expireTime).Seconds()))
}
return
}
@ -203,7 +203,7 @@ func (r *Resolver) batchExchange(clients []dnsClient, m *D.Msg) (msg *D.Msg, err
elm := fast.Wait()
if elm == nil {
err := errors.New("All DNS requests failed")
err := errors.New("all DNS requests failed")
if fErr := fast.Error(); fErr != nil {
err = fmt.Errorf("%w, first error: %s", err, fErr.Error())
}