mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
Switch to Go 1.13 error wrapping (#604)
* Replaced errors.Wrap with fmt.Errorf (#589) * Find: errors\.Wrap\(([^,]+),\s+(["`][^"`]*)(["`])\) Replace: fmt.Errorf($2: %w$3, $1) * Replaced errors.Wrapf with fmt.Errorf (#589) * Find: errors\.Wrapf\(([^,]+),\s+(["`][^"`]*)(["`])\) Replace: fmt.Errorf($2: %w$3, $1) * Find: errors\.Wrapf\(([^,]+),\s+(["`][^"`]*)(["`])(,[^)]+)\) * Replace: fmt.Errorf($2: %w$3$4, $1) * Replaced errors.Errorf with fmt.Errorf (#589) * Find: errors\.Errorf Replace: fmt.Errorf * Cleaned up remaining imports * Cleanup * Regenerate provider support matrix This was broken by #533 ... and it's now the third time this has been missed.
This commit is contained in:
committed by
Tom Limoncelli
parent
cae35a2c8f
commit
825ba2d081
@@ -1,10 +1,9 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// SetTargetSRV sets the SRV fields.
|
||||
@@ -30,7 +29,7 @@ func (rc *RecordConfig) setTargetSRVIntAndStrings(priority uint16, weight, port,
|
||||
return rc.SetTargetSRV(priority, uint16(i64weight), uint16(i64port), target)
|
||||
}
|
||||
}
|
||||
return errors.Wrap(err, "SRV value too big for uint16")
|
||||
return fmt.Errorf("SRV value too big for uint16: %w", err)
|
||||
}
|
||||
|
||||
// SetTargetSRVStrings is like SetTargetSRV but accepts all parameters as strings.
|
||||
@@ -39,7 +38,7 @@ func (rc *RecordConfig) SetTargetSRVStrings(priority, weight, port, target strin
|
||||
if i64priority, err = strconv.ParseUint(priority, 10, 16); err == nil {
|
||||
return rc.setTargetSRVIntAndStrings(uint16(i64priority), weight, port, target)
|
||||
}
|
||||
return errors.Wrap(err, "SRV value too big for uint16")
|
||||
return fmt.Errorf("SRV value too big for uint16: %w", err)
|
||||
}
|
||||
|
||||
// SetTargetSRVPriorityString is like SetTargetSRV but accepts priority as an
|
||||
@@ -54,7 +53,7 @@ func (rc *RecordConfig) SetTargetSRVPriorityString(priority uint16, s string) er
|
||||
case 2:
|
||||
return rc.setTargetSRVIntAndStrings(priority, part[0], part[1], ".")
|
||||
default:
|
||||
return errors.Errorf("SRV value does not contain 3 fields: (%#v)", s)
|
||||
return fmt.Errorf("SRV value does not contain 3 fields: (%#v)", s)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +61,7 @@ func (rc *RecordConfig) SetTargetSRVPriorityString(priority uint16, s string) er
|
||||
func (rc *RecordConfig) SetTargetSRVString(s string) error {
|
||||
part := strings.Fields(s)
|
||||
if len(part) != 4 {
|
||||
return errors.Errorf("SRC value does not contain 4 fields: (%#v)", s)
|
||||
return fmt.Errorf("SRC value does not contain 4 fields: (%#v)", s)
|
||||
}
|
||||
return rc.SetTargetSRVStrings(part[0], part[1], part[2], part[3])
|
||||
}
|
||||
|
Reference in New Issue
Block a user