1
0
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:
Patrick Gaskin
2020-01-28 11:06:56 -05:00
committed by Tom Limoncelli
parent cae35a2c8f
commit 825ba2d081
64 changed files with 328 additions and 379 deletions

View File

@@ -8,7 +8,6 @@ import (
"github.com/miekg/dns"
"github.com/miekg/dns/dnsutil"
"github.com/pkg/errors"
)
// RecordConfig stores a DNS record.
@@ -110,10 +109,10 @@ func (rc *RecordConfig) SetLabel(short, origin string) {
// Assertions that make sure the function is being used correctly:
if strings.HasSuffix(origin, ".") {
panic(errors.Errorf("origin (%s) is not supposed to end with a dot", origin))
panic(fmt.Errorf("origin (%s) is not supposed to end with a dot", origin))
}
if strings.HasSuffix(short, ".") {
panic(errors.Errorf("short (%s) is not supposed to end with a dot", origin))
panic(fmt.Errorf("short (%s) is not supposed to end with a dot", origin))
}
// TODO(tlim): We should add more validation here or in a separate validation
@@ -145,10 +144,10 @@ func (rc *RecordConfig) SetLabelFromFQDN(fqdn, origin string) {
// Assertions that make sure the function is being used correctly:
if strings.HasSuffix(origin, ".") {
panic(errors.Errorf("origin (%s) is not supposed to end with a dot", origin))
panic(fmt.Errorf("origin (%s) is not supposed to end with a dot", origin))
}
if strings.HasSuffix(fqdn, "..") {
panic(errors.Errorf("fqdn (%s) is not supposed to end with double dots", origin))
panic(fmt.Errorf("fqdn (%s) is not supposed to end with double dots", origin))
}
if strings.HasSuffix(fqdn, ".") {