From 80bd617378f76536badd29ed7c77364b17c2e348 Mon Sep 17 00:00:00 2001 From: CarterPerez-dev Date: Sun, 19 Jul 2026 03:18:17 -0400 Subject: [PATCH] style(canary): format config_test.go with golines (max-len 80) Vertically wrap the long table-driven case literals and one Fatalf call to satisfy the project's golines linter (max-len 80, reformat-tags), which the CI Go lint job flagged. Formatting only; no test behavior change. --- .../backend/internal/config/config_test.go | 72 ++++++++++++++++--- 1 file changed, 62 insertions(+), 10 deletions(-) diff --git a/PROJECTS/beginner/canary-token-generator/backend/internal/config/config_test.go b/PROJECTS/beginner/canary-token-generator/backend/internal/config/config_test.go index 5d877b9d..ceda396b 100644 --- a/PROJECTS/beginner/canary-token-generator/backend/internal/config/config_test.go +++ b/PROJECTS/beginner/canary-token-generator/backend/internal/config/config_test.go @@ -16,13 +16,49 @@ func TestEnvCallbackScalarAndAliases(t *testing.T) { wantKey string wantVal any }{ - {"mysql fake enabled alias", "MYSQL_FAKE_ENABLED", "true", "mysql.enabled", "true"}, - {"mysql canonical enabled", "MYSQL_ENABLED", "true", "mysql.enabled", "true"}, - {"mysql fake addr alias", "MYSQL_FAKE_ADDR", "0.0.0.0:33306", "mysql.addr", "0.0.0.0:33306"}, - {"turnstile secret alias", "TURNSTILE_SECRET", "sk", "turnstile.secret_key", "sk"}, + { + "mysql fake enabled alias", + "MYSQL_FAKE_ENABLED", + "true", + "mysql.enabled", + "true", + }, + { + "mysql canonical enabled", + "MYSQL_ENABLED", + "true", + "mysql.enabled", + "true", + }, + { + "mysql fake addr alias", + "MYSQL_FAKE_ADDR", + "0.0.0.0:33306", + "mysql.addr", + "0.0.0.0:33306", + }, + { + "turnstile secret alias", + "TURNSTILE_SECRET", + "sk", + "turnstile.secret_key", + "sk", + }, {"unmapped key dropped", "SOME_RANDOM_VAR", "x", "", nil}, - {"blank slice dropped keeps default", "TRUSTED_PROXY_CIDRS", "", "", nil}, - {"whitespace-only slice dropped", "TRUSTED_PROXY_CIDRS", " , ,", "", nil}, + { + "blank slice dropped keeps default", + "TRUSTED_PROXY_CIDRS", + "", + "", + nil, + }, + { + "whitespace-only slice dropped", + "TRUSTED_PROXY_CIDRS", + " , ,", + "", + nil, + }, } for _, c := range cases { t.Run(c.name, func(t *testing.T) { @@ -44,15 +80,31 @@ func TestEnvCallbackSliceSplitting(t *testing.T) { want []string }{ {"single", "10.0.0.0/8", []string{"10.0.0.0/8"}}, - {"multiple", "10.0.0.0/8,172.16.0.0/12,192.168.0.0/16", []string{"10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"}}, - {"spaces trimmed", " 10.0.0.0/8 , 172.16.0.0/12 ", []string{"10.0.0.0/8", "172.16.0.0/12"}}, - {"empty entries dropped", "10.0.0.0/8,,192.168.0.0/16,", []string{"10.0.0.0/8", "192.168.0.0/16"}}, + { + "multiple", + "10.0.0.0/8,172.16.0.0/12,192.168.0.0/16", + []string{"10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"}, + }, + { + "spaces trimmed", + " 10.0.0.0/8 , 172.16.0.0/12 ", + []string{"10.0.0.0/8", "172.16.0.0/12"}, + }, + { + "empty entries dropped", + "10.0.0.0/8,,192.168.0.0/16,", + []string{"10.0.0.0/8", "192.168.0.0/16"}, + }, } for _, c := range cases { t.Run(c.name, func(t *testing.T) { gotKey, gotVal := envCallback("TRUSTED_PROXY_CIDRS", c.value) if gotKey != "server.trusted_proxy_cidrs" { - t.Fatalf("key: got %q, want %q", gotKey, "server.trusted_proxy_cidrs") + t.Fatalf( + "key: got %q, want %q", + gotKey, + "server.trusted_proxy_cidrs", + ) } got, ok := gotVal.([]string) if !ok {