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
@@ -7,16 +7,16 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/StackExchange/dnscontrol/v2/models"
|
||||
"github.com/StackExchange/dnscontrol/v2/pkg/printer"
|
||||
"github.com/StackExchange/dnscontrol/v2/providers"
|
||||
"github.com/StackExchange/dnscontrol/v2/providers/diff"
|
||||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
gandiclient "github.com/prasmussen/gandi-api/client"
|
||||
gandilivedomain "github.com/prasmussen/gandi-api/live_dns/domain"
|
||||
gandiliverecord "github.com/prasmussen/gandi-api/live_dns/record"
|
||||
gandilivezone "github.com/prasmussen/gandi-api/live_dns/zone"
|
||||
|
||||
"github.com/StackExchange/dnscontrol/v2/models"
|
||||
"github.com/StackExchange/dnscontrol/v2/pkg/printer"
|
||||
"github.com/StackExchange/dnscontrol/v2/providers"
|
||||
"github.com/StackExchange/dnscontrol/v2/providers/diff"
|
||||
)
|
||||
|
||||
var liveFeatures = providers.DocumentationNotes{
|
||||
@@ -36,7 +36,7 @@ func init() {
|
||||
func newLiveDsp(m map[string]string, metadata json.RawMessage) (providers.DNSServiceProvider, error) {
|
||||
APIKey := m["apikey"]
|
||||
if APIKey == "" {
|
||||
return nil, errors.Errorf("missing Gandi apikey")
|
||||
return nil, fmt.Errorf("missing Gandi apikey")
|
||||
}
|
||||
|
||||
return newLiveClient(APIKey), nil
|
||||
@@ -74,7 +74,7 @@ func (c *liveClient) GetNameservers(domain string) ([]*models.Nameserver, error)
|
||||
domains := []string{}
|
||||
response, err := c.client.Get("/nameservers/"+domain, &domains)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("failed to get nameservers for domain %s", domain)
|
||||
return nil, fmt.Errorf("failed to get nameservers for domain %s", domain)
|
||||
}
|
||||
defer response.Body.Close()
|
||||
|
||||
@@ -201,7 +201,7 @@ func (c *liveClient) recordConfigFromInfo(infos []*gandiliverecord.Info, origin
|
||||
}
|
||||
err := rc.SetTargetTXTs(parsed)
|
||||
if err != nil {
|
||||
panic(errors.Wrapf(err, "recordConfigFromInfo=TXT failed"))
|
||||
panic(fmt.Errorf("recordConfigFromInfo=TXT failed: %w", err))
|
||||
}
|
||||
rcs = append(rcs, rc)
|
||||
} else {
|
||||
@@ -218,7 +218,7 @@ func (c *liveClient) recordConfigFromInfo(infos []*gandiliverecord.Info, origin
|
||||
default:
|
||||
err := rc.PopulateFromString(rtype, value, origin)
|
||||
if err != nil {
|
||||
panic(errors.Wrapf(err, "recordConfigFromInfo failed"))
|
||||
panic(fmt.Errorf("recordConfigFromInfo failed: %w", err))
|
||||
}
|
||||
}
|
||||
rcs = append(rcs, rc)
|
||||
@@ -240,7 +240,7 @@ func (c *liveClient) recordsToInfo(records models.Records) (models.Records, []*g
|
||||
rec.TTL = 300
|
||||
}
|
||||
if rec.TTL > 2592000 {
|
||||
return nil, nil, errors.Errorf("ERROR: Gandi does not support TTLs > 30 days (TTL=%d)", rec.TTL)
|
||||
return nil, nil, fmt.Errorf("ERROR: Gandi does not support TTLs > 30 days (TTL=%d)", rec.TTL)
|
||||
}
|
||||
if rec.Type == "NS" && rec.GetLabel() == "@" {
|
||||
if !strings.HasSuffix(rec.GetTargetField(), ".gandi.net.") {
|
||||
|
||||
Reference in New Issue
Block a user