1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

CODE: Fix simple staticcheck items (#1329)

This commit is contained in:
Tom Limoncelli
2021-12-14 16:28:37 -05:00
committed by GitHub
parent cc6638fb95
commit 02c5258396
6 changed files with 5 additions and 15 deletions

View File

@ -131,9 +131,7 @@ func (a *azurednsProvider) GetNameservers(domain string) ([]*models.Nameserver,
var nss []string
if zone.ZoneProperties != nil {
for _, ns := range *zone.ZoneProperties.NameServers {
nss = append(nss, ns)
}
nss = append(nss, *zone.ZoneProperties.NameServers...)
}
return models.ToNameserversStripTD(nss)
}

View File

@ -175,9 +175,6 @@ func (c *bindProvider) GetZoneRecords(domain string) (models.Records, error) {
if err != nil {
return nil, err
}
// FIXME(tlim): Empty branch? Is the intention to skip SOAs?
if rec.Type == "SOA" {
}
foundRecords = append(foundRecords, &rec)
}

View File

@ -135,7 +135,7 @@ func (g *gcloudProvider) GetNameservers(domain string) ([]*models.Nameserver, er
return nil, err
}
if zone == nil {
return nil, fmt.Errorf("Domain %q not found in your GCLOUD account", domain)
return nil, fmt.Errorf("domain %q not found in your GCLOUD account", domain)
}
return models.ToNameserversStripTD(zone.NameServers)
}

View File

@ -220,7 +220,7 @@ func (api *hetznerProvider) request(endpoint string, method string, request inte
cleanupResponseBody := func() {
err := resp.Body.Close()
if err != nil {
fmt.Println(fmt.Sprintf("failed closing response body: %q", err))
fmt.Printf("failed closing response body: %q\n", err)
}
}

View File

@ -521,10 +521,7 @@ func getZoneID(zone r53Types.HostedZone, r *models.RecordConfig) string {
/** Removes "/hostedzone/"" prefix from AWS ZoneId */
func parseZoneId(zoneID string) string {
if strings.HasPrefix(zoneID, "/hostedzone/") {
zoneID = strings.TrimPrefix(zoneID, "/hostedzone/")
}
return zoneID
return strings.TrimPrefix(zoneID, "/hostedzone/")
}
func (r *route53Provider) GetRegistrarCorrections(dc *models.DomainConfig) ([]*models.Correction, error) {

View File

@ -225,9 +225,7 @@ func toVultrRecord(dc *models.DomainConfig, rc *models.RecordConfig, vultrID int
data := rc.GetTargetField()
// Vultr does not use a period suffix for CNAME, NS, or MX.
if strings.HasSuffix(data, ".") {
data = data[:len(data)-1]
}
data = strings.TrimSuffix(data, ".")
var priority *int