mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2026-01-09 09:45:02 +08:00
CHORE: Linting (#3645)
This commit is contained in:
parent
0d60e0c166
commit
d37736e1f0
4 changed files with 16 additions and 18 deletions
|
|
@ -12,13 +12,13 @@ import (
|
|||
)
|
||||
|
||||
func generateFeatureMatrix() error {
|
||||
var replacementContent string = "Jump to a table:\n\n"
|
||||
var replacementContent = "Jump to a table:\n\n"
|
||||
matrix := matrixData()
|
||||
|
||||
for _, tableTitle := range matrix.FeatureTablesTitles {
|
||||
var jumptotableContent string = ""
|
||||
var jumptotableContent = ""
|
||||
|
||||
var anchor string = strings.ToLower(tableTitle)
|
||||
var anchor = strings.ToLower(tableTitle)
|
||||
anchor = strings.Replace(anchor, " ", "-", -1)
|
||||
|
||||
jumptotableContent += fmt.Sprintf("- [%s](#%s)\n", tableTitle, anchor)
|
||||
|
|
|
|||
|
|
@ -183,11 +183,6 @@ func getCertInfo(pemBytes []byte) (names []string, remaining float64, err error)
|
|||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
//lint:ignore S1024 Fixing this without unit tests scares me.
|
||||
// TODO(tlim): I think the fix is the line below but since this code
|
||||
// may be decommed eventually, and since there are no unit tests,
|
||||
// I'm not excited about making this change.
|
||||
// var daysLeft = float64(time.Until(cert.NotAfter)) / float64(time.Hour*24)
|
||||
daysLeft := float64(time.Until(cert.NotAfter)) / float64(time.Hour*24)
|
||||
return cert.DNSNames, daysLeft, nil
|
||||
}
|
||||
|
|
@ -303,10 +298,13 @@ func (c *certManager) getAndRunCorrections(d *models.DomainConfig) error {
|
|||
for _, corr := range cs {
|
||||
fmt.Printf("Running [%s]\n", corr.Msg)
|
||||
err = corr.F()
|
||||
c.notifier.Notify(d.Name, "certs", corr.Msg, err, false)
|
||||
err2 := c.notifier.Notify(d.Name, "certs", corr.Msg, err, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err2 != nil {
|
||||
return err2
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ func (api *dnsMadeEasyProvider) domainExists(name string) (bool, error) {
|
|||
return ok, nil
|
||||
}
|
||||
|
||||
func (api *dnsMadeEasyProvider) findDomainId(name string) (int, error) {
|
||||
func (api *dnsMadeEasyProvider) findDomainID(name string) (int, error) {
|
||||
if err := api.loadDomains(); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
|
@ -85,12 +85,12 @@ func (api *dnsMadeEasyProvider) findDomainId(name string) (int, error) {
|
|||
}
|
||||
|
||||
func (api *dnsMadeEasyProvider) fetchDomainRecords(domainName string) ([]recordResponseDataEntry, error) {
|
||||
domainId, err := api.findDomainId(domainName)
|
||||
domainID, err := api.findDomainID(domainName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res, err := api.restAPI.recordGet(domainId)
|
||||
res, err := api.restAPI.recordGet(domainID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("fetching records failed: %w", err)
|
||||
}
|
||||
|
|
@ -108,12 +108,12 @@ func (api *dnsMadeEasyProvider) fetchDomainRecords(domainName string) ([]recordR
|
|||
}
|
||||
|
||||
func (api *dnsMadeEasyProvider) fetchDomainNameServers(domainName string) ([]string, error) {
|
||||
domainId, err := api.findDomainId(domainName)
|
||||
domainID, err := api.findDomainID(domainName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res, err := api.restAPI.singleDomainGet(domainId)
|
||||
res, err := api.restAPI.singleDomainGet(domainID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("fetching domain from DNSMADEEASY failed: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ func New(settings map[string]string, _ json.RawMessage) (providers.DNSServicePro
|
|||
|
||||
func (api *dnsMadeEasyProvider) GetZoneRecordsCorrections(dc *models.DomainConfig, existingRecords models.Records) ([]*models.Correction, int, error) {
|
||||
domainName := dc.Name
|
||||
domainId, err := api.findDomainId(domainName)
|
||||
domainID, err := api.findDomainID(domainName)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
|
@ -139,7 +139,7 @@ func (api *dnsMadeEasyProvider) GetZoneRecordsCorrections(dc *models.DomainConfi
|
|||
corr := &models.Correction{
|
||||
Msg: strings.Join(deleteDescription, "\n\t"),
|
||||
F: func() error {
|
||||
return api.deleteRecords(domainId, deleteRecordIds)
|
||||
return api.deleteRecords(domainID, deleteRecordIds)
|
||||
},
|
||||
}
|
||||
corrections = append(corrections, corr)
|
||||
|
|
@ -157,7 +157,7 @@ func (api *dnsMadeEasyProvider) GetZoneRecordsCorrections(dc *models.DomainConfi
|
|||
corr := &models.Correction{
|
||||
Msg: strings.Join(createDescription, "\n\t"),
|
||||
F: func() error {
|
||||
return api.createRecords(domainId, createRecords)
|
||||
return api.createRecords(domainID, createRecords)
|
||||
},
|
||||
}
|
||||
corrections = append(corrections, corr)
|
||||
|
|
@ -180,7 +180,7 @@ func (api *dnsMadeEasyProvider) GetZoneRecordsCorrections(dc *models.DomainConfi
|
|||
corr := &models.Correction{
|
||||
Msg: strings.Join(modifyDescription, "\n\t"),
|
||||
F: func() error {
|
||||
return api.updateRecords(domainId, modifyRecords)
|
||||
return api.updateRecords(domainID, modifyRecords)
|
||||
},
|
||||
}
|
||||
corrections = append(corrections, corr)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue