Repository: favonia/cloudflare-ddns
Pull request #265 (2022-11-13 12:34:06)

fix(monitor): correct printf format string

codecov[bot]: # [Codecov](https://codecov.io/gh/favonia/cloudflare-ddns/pull/265?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=favonia) Report
> Merging [#265](https://codecov.io/gh/favonia/cloudflare-ddns/pull/265?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=favonia) (af0be8a) into [main](https://codecov.io/gh/favonia/cloudflare-ddns/commit/c54237d978020c95b62cb28d33125e3471235ef2?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=favonia) (c54237d) will **not change** coverage.
> The diff coverage is `100.00%`.

```diff
@@           Coverage Diff           @@
##             main     #265   +/-   ##
=======================================
  Coverage   85.35%   85.35%           
=======================================
  Files          29       29           
  Lines        1946     1946           
=======================================
  Hits         1661     1661           
  Misses        274      274           
  Partials       11       11           
```

| Flag | Coverage Δ | |
|---|---|---|
| unittests | `85.35% <100.00%> (ø)` | |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=favonia#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Impacted Files](https://codecov.io/gh/favonia/cloudflare-ddns/pull/265?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=favonia) | Coverage Δ | |
|---|---|---|
| [internal/api/cloudflare.go](https://codecov.io/gh/favonia/cloudflare-ddns/pull/265/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=favonia#diff-aW50ZXJuYWwvYXBpL2Nsb3VkZmxhcmUuZ28=) | `100.00% <100.00%> (ø)` | |
| [internal/config/env.go](https://codecov.io/gh/favonia/cloudflare-ddns/pull/265/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=favonia#diff-aW50ZXJuYWwvY29uZmlnL2Vudi5nbw==) | `98.58% <100.00%> (ø)` | |
| [internal/monitor/healthchecks.go](https://codecov.io/gh/favonia/cloudflare-ddns/pull/265/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=favonia#diff-aW50ZXJuYWwvbW9uaXRvci9oZWFsdGhjaGVja3MuZ28=) | `86.95% <100.00%> (ø)` | |

:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=favonia)


Patch:
diff --git a/.golangci.yaml b/.golangci.yaml
index c26c79c..ab22bfc 100644
--- a/.golangci.yaml
+++ b/.golangci.yaml
@@ -12,11 +12,14 @@ linters-settings:
     settings:
       printf:
         funcs:
-          - (github.com/favonia/cloudflare-ddns/internal/pp).Infof
-          - (github.com/favonia/cloudflare-ddns/internal/pp).Noticef
-          - (github.com/favonia/cloudflare-ddns/internal/pp).Warningf
-          - (github.com/favonia/cloudflare-ddns/internal/pp).Errorf
-          - (github.com/favonia/cloudflare-ddns/internal/pp).printf
+          - (github.com/favonia/cloudflare-ddns/internal/pp.PP).Infof
+          - (github.com/favonia/cloudflare-ddns/internal/pp.PP).Noticef
+          - (github.com/favonia/cloudflare-ddns/internal/pp.PP).Warningf
+          - (github.com/favonia/cloudflare-ddns/internal/pp.PP).Errorf
+          - (*github.com/favonia/cloudflare-ddns/internal/mocks.MockPPMockRecorder).Infof
+          - (*github.com/favonia/cloudflare-ddns/internal/mocks.MockPPMockRecorder).Noticef
+          - (*github.com/favonia/cloudflare-ddns/internal/mocks.MockPPMockRecorder).Warningf
+          - (*github.com/favonia/cloudflare-ddns/internal/mocks.MockPPMockRecorder).Errorf
 
 issues:
   exclude-rules:
diff --git a/internal/api/cloudflare.go b/internal/api/cloudflare.go
index 236afa3..bf34b4c 100644
--- a/internal/api/cloudflare.go
+++ b/internal/api/cloudflare.go
@@ -113,7 +113,7 @@ func (h *CloudflareHandle) ActiveZones(ctx context.Context, ppfmt pp.PP, name st
 			"moved",        // domain registrar not pointing to Cloudflare
 			"pending":      // the setup was not completed
 			ppfmt.Warningf(pp.EmojiWarning, "Zone %q is %q; your Cloudflare setup is incomplete", name, zone.Status)
-			ppfmt.Warningf(pp.EmojiWarning, "Some features might stop working", name, zone.Status)
+			ppfmt.Warningf(pp.EmojiWarning, "Some features might stop working")
 			ids = append(ids, zone.ID)
 		case
 			"deleted": // archived, pending/moved for too long
diff --git a/internal/config/env.go b/internal/config/env.go
index cc10e72..b6877fa 100644
--- a/internal/config/env.go
+++ b/internal/config/env.go
@@ -211,7 +211,7 @@ func ReadProvider(ppfmt pp.PP, key, keyDeprecated string, field *provider.Provid
 			ppfmt.Errorf(
 				pp.EmojiUserError,
 				`Parameter %s does not accept "cloudflare"; use "cloudflare.doh" or "cloudflare.trace"`,
-				key, key,
+				key,
 			)
 			return false
 		case "cloudflare.trace":
diff --git a/internal/monitor/healthchecks.go b/internal/monitor/healthchecks.go
index 4ca90ee..6940e54 100644
--- a/internal/monitor/healthchecks.go
+++ b/internal/monitor/healthchecks.go
@@ -159,7 +159,7 @@ func (h *HealthChecks) Failure(ctx context.Context, ppfmt pp.PP) bool {
 
 func (h *HealthChecks) ExitStatus(ctx context.Context, ppfmt pp.PP, code int) bool {
 	if code < 0 || code > 255 {
-		ppfmt.Errorf(pp.EmojiImpossible, "Exit code (%i) not within the range 0-255", code)
+		ppfmt.Errorf(pp.EmojiImpossible, "Exit code (%d) not within the range 0-255", code)
 		return false
 	}
 


Test patch:
diff --git a/internal/api/cloudflare_test.go b/internal/api/cloudflare_test.go
index 45b6a8f..da00f45 100644
--- a/internal/api/cloudflare_test.go
+++ b/internal/api/cloudflare_test.go
@@ -413,7 +413,7 @@ func TestZoneOfDomain(t *testing.T) {
 			func(m *mocks.MockPP) {
 				gomock.InOrder(
 					m.EXPECT().Warningf(pp.EmojiWarning, "Zone %q is %q; your Cloudflare setup is incomplete", "test.org", "pending"), //nolint:lll
-					m.EXPECT().Warningf(pp.EmojiWarning, "Some features might stop working", "test.org", "pending"),
+					m.EXPECT().Warningf(pp.EmojiWarning, "Some features might stop working"),
 				)
 			},
 		},
@@ -424,7 +424,7 @@ func TestZoneOfDomain(t *testing.T) {
 			func(m *mocks.MockPP) {
 				gomock.InOrder(
 					m.EXPECT().Warningf(pp.EmojiWarning, "Zone %q is %q; your Cloudflare setup is incomplete", "test.org", "initializing"), //nolint:lll
-					m.EXPECT().Warningf(pp.EmojiWarning, "Some features might stop working", "test.org", "initializing"),
+					m.EXPECT().Warningf(pp.EmojiWarning, "Some features might stop working"),
 				)
 			},
 		},
diff --git a/internal/config/env_test.go b/internal/config/env_test.go
index 92911f1..8723032 100644
--- a/internal/config/env_test.go
+++ b/internal/config/env_test.go
@@ -556,7 +556,7 @@ func TestReadProvider(t *testing.T) {
 				m.EXPECT().Errorf(
 					pp.EmojiUserError,
 					`Parameter %s does not accept "cloudflare"; use "cloudflare.doh" or "cloudflare.trace"`,
-					key, key,
+					key,
 				)
 			},
 		},
diff --git a/internal/monitor/healthchecks_test.go b/internal/monitor/healthchecks_test.go
index b165f21..a5e5cdd 100644
--- a/internal/monitor/healthchecks_test.go
+++ b/internal/monitor/healthchecks_test.go
@@ -241,7 +241,7 @@ func TestEndPoints(t *testing.T) {
 			nil,
 			false, false,
 			func(m *mocks.MockPP) {
-				m.EXPECT().Errorf(pp.EmojiImpossible, "Exit code (%i) not within the range 0-255", -1)
+				m.EXPECT().Errorf(pp.EmojiImpossible, "Exit code (%d) not within the range 0-255", -1)
 			},
 		},
 	} {