Use fmt.Errorf for creating error with formatting (#5968)
This commit is contained in:
parent
f22e7a1465
commit
d31f1735d9
|
@ -1,7 +1,6 @@
|
||||||
package dns_query
|
package dns_query
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -162,7 +161,7 @@ func (d *DnsQuery) getDnsQueryTime(domain string, server string) (float64, int,
|
||||||
|
|
||||||
func (d *DnsQuery) parseRecordType() (uint16, error) {
|
func (d *DnsQuery) parseRecordType() (uint16, error) {
|
||||||
var recordType uint16
|
var recordType uint16
|
||||||
var error error
|
var err error
|
||||||
|
|
||||||
switch d.RecordType {
|
switch d.RecordType {
|
||||||
case "A":
|
case "A":
|
||||||
|
@ -188,10 +187,10 @@ func (d *DnsQuery) parseRecordType() (uint16, error) {
|
||||||
case "TXT":
|
case "TXT":
|
||||||
recordType = dns.TypeTXT
|
recordType = dns.TypeTXT
|
||||||
default:
|
default:
|
||||||
error = errors.New(fmt.Sprintf("Record type %s not recognized", d.RecordType))
|
err = fmt.Errorf("Record type %s not recognized", d.RecordType)
|
||||||
}
|
}
|
||||||
|
|
||||||
return recordType, error
|
return recordType, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func setResult(result ResultType, fields map[string]interface{}, tags map[string]string) {
|
func setResult(result ResultType, fields map[string]interface{}, tags map[string]string) {
|
||||||
|
|
Loading…
Reference in New Issue