Use fmt.Errorf for creating error with formatting (#5968)

This commit is contained in:
Oleg Kovalov 2019-06-07 21:24:26 +02:00 committed by Daniel Nelson
parent f22e7a1465
commit d31f1735d9
1 changed files with 3 additions and 4 deletions

View File

@ -1,7 +1,6 @@
package dns_query
import (
"errors"
"fmt"
"net"
"strconv"
@ -162,7 +161,7 @@ func (d *DnsQuery) getDnsQueryTime(domain string, server string) (float64, int,
func (d *DnsQuery) parseRecordType() (uint16, error) {
var recordType uint16
var error error
var err error
switch d.RecordType {
case "A":
@ -188,10 +187,10 @@ func (d *DnsQuery) parseRecordType() (uint16, error) {
case "TXT":
recordType = dns.TypeTXT
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) {