From d37736e1f0631213d7f39ef453dcbafa3117437a Mon Sep 17 00:00:00 2001 From: Tom Limoncelli Date: Mon, 30 Jun 2025 13:35:12 -0400 Subject: [PATCH] CHORE: Linting (#3645) --- build/generate/featureMatrix.go | 6 +++--- pkg/acme/acme.go | 10 ++++------ providers/dnsmadeeasy/api.go | 10 +++++----- providers/dnsmadeeasy/dnsMadeEasyProvider.go | 8 ++++---- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/build/generate/featureMatrix.go b/build/generate/featureMatrix.go index 2ee17ccf0..aa2c99a08 100644 --- a/build/generate/featureMatrix.go +++ b/build/generate/featureMatrix.go @@ -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) diff --git a/pkg/acme/acme.go b/pkg/acme/acme.go index 782b1f22f..14d7b7655 100644 --- a/pkg/acme/acme.go +++ b/pkg/acme/acme.go @@ -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 } diff --git a/providers/dnsmadeeasy/api.go b/providers/dnsmadeeasy/api.go index b062e08d6..296496f0c 100644 --- a/providers/dnsmadeeasy/api.go +++ b/providers/dnsmadeeasy/api.go @@ -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) } diff --git a/providers/dnsmadeeasy/dnsMadeEasyProvider.go b/providers/dnsmadeeasy/dnsMadeEasyProvider.go index 46d734185..c0c66b8f4 100644 --- a/providers/dnsmadeeasy/dnsMadeEasyProvider.go +++ b/providers/dnsmadeeasy/dnsMadeEasyProvider.go @@ -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)