From 3323a562c99466c191b2461b9bdb71119ff8eab5 Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Wed, 18 Feb 2026 09:05:07 -0800 Subject: [PATCH] Run go fix --- alert_test.go | 3 --- config_test.go | 6 ++---- main_test.go | 6 ------ monitor_test.go | 11 +++-------- util_test.go | 1 - 5 files changed, 5 insertions(+), 22 deletions(-) diff --git a/alert_test.go b/alert_test.go index 220fda8..8494fa0 100644 --- a/alert_test.go +++ b/alert_test.go @@ -22,7 +22,6 @@ func TestAlertValidate(t *testing.T) { } for _, c := range cases { - c := c t.Run(c.name, func(t *testing.T) { t.Parallel() @@ -77,7 +76,6 @@ func TestAlertSend(t *testing.T) { } for _, c := range cases { - c := c t.Run(c.name, func(t *testing.T) { t.Parallel() @@ -123,7 +121,6 @@ func TestAlertBuildTemplate(t *testing.T) { } for _, c := range cases { - c := c t.Run(c.name, func(t *testing.T) { t.Parallel() diff --git a/config_test.go b/config_test.go index 0e72396..36baf26 100644 --- a/config_test.go +++ b/config_test.go @@ -24,7 +24,6 @@ func TestLoadConfig(t *testing.T) { {"./test/valid-config.hcl", nil, "Valid config file"}, } for _, c := range cases { - c := c t.Run(c.name, func(t *testing.T) { t.Parallel() @@ -51,7 +50,7 @@ func TestDefaultConfig(t *testing.T) { m.Config{ CheckInterval: 1 * time.Second, DefaultAlertAfter: 2, - DefaultAlertEvery: Ptr(0), + DefaultAlertEvery: new(0), DefaultAlertDown: []string{"log_command"}, }, "override defaults", @@ -61,7 +60,7 @@ func TestDefaultConfig(t *testing.T) { m.Config{ CheckInterval: 30 * time.Second, DefaultAlertAfter: 1, - DefaultAlertEvery: Ptr(-1), + DefaultAlertEvery: new(-1), DefaultAlertDown: []string{}, }, "default defaults", @@ -69,7 +68,6 @@ func TestDefaultConfig(t *testing.T) { } for _, c := range cases { - c := c t.Run(c.name, func(t *testing.T) { t.Parallel() diff --git a/main_test.go b/main_test.go index 2367548..632e7b5 100644 --- a/main_test.go +++ b/main_test.go @@ -6,10 +6,6 @@ import ( m "git.iamthefij.com/iamthefij/minitor-go/v2" ) -func Ptr[T any](v T) *T { - return &v -} - // TestCheckConfig tests the checkConfig function // It also tests results for potentially invalid configuration. For example, no alerts func TestCheckMonitors(t *testing.T) { @@ -91,7 +87,6 @@ func TestCheckMonitors(t *testing.T) { } for _, c := range cases { - c := c t.Run(c.name, func(t *testing.T) { t.Parallel() @@ -171,7 +166,6 @@ func TestFirstRunAlerts(t *testing.T) { } for _, c := range cases { - c := c t.Run(c.name, func(t *testing.T) { t.Parallel() diff --git a/monitor_test.go b/monitor_test.go index d0d880f..584e6b1 100644 --- a/monitor_test.go +++ b/monitor_test.go @@ -25,7 +25,6 @@ func TestMonitorValidate(t *testing.T) { } for _, c := range cases { - c := c t.Run(c.name, func(t *testing.T) { t.Parallel() @@ -103,7 +102,6 @@ func TestMonitorGetAlertNames(t *testing.T) { } for _, c := range cases { - c := c t.Run(c.name, func(t *testing.T) { t.Parallel() @@ -175,7 +173,6 @@ func TestMonitorFailureAlertAfter(t *testing.T) { } for _, c := range cases { - c := c t.Run(c.name, func(t *testing.T) { t.Parallel() @@ -204,15 +201,14 @@ func TestMonitorFailureAlertEvery(t *testing.T) { }{ {m.Monitor{ShellCommand: "false", AlertAfter: 1}, []bool{true}, "No AlertEvery set"}, // Defaults to true because AlertAfter and AlertEvery default to nil // Alert first time only, after 1 - {m.Monitor{ShellCommand: "false", AlertAfter: 1, AlertEvery: Ptr(0)}, []bool{true, false, false}, "Alert first time only after 1"}, + {m.Monitor{ShellCommand: "false", AlertAfter: 1, AlertEvery: new(0)}, []bool{true, false, false}, "Alert first time only after 1"}, // Alert every time, after 1 - {m.Monitor{ShellCommand: "false", AlertAfter: 1, AlertEvery: Ptr(1)}, []bool{true, true, true}, "Alert every time after 1"}, + {m.Monitor{ShellCommand: "false", AlertAfter: 1, AlertEvery: new(1)}, []bool{true, true, true}, "Alert every time after 1"}, // Alert every other time, after 1 - {m.Monitor{ShellCommand: "false", AlertAfter: 1, AlertEvery: Ptr(2)}, []bool{true, false, true, false}, "Alert every other time after 1"}, + {m.Monitor{ShellCommand: "false", AlertAfter: 1, AlertEvery: new(2)}, []bool{true, false, true, false}, "Alert every other time after 1"}, } for _, c := range cases { - c := c t.Run(c.name, func(t *testing.T) { t.Parallel() @@ -301,7 +297,6 @@ func TestMonitorCheck(t *testing.T) { } for _, c := range cases { - c := c t.Run(c.name, func(t *testing.T) { t.Parallel() diff --git a/util_test.go b/util_test.go index b4c1a22..568cf57 100644 --- a/util_test.go +++ b/util_test.go @@ -24,7 +24,6 @@ func TestUtilEqualSliceString(t *testing.T) { } for _, c := range cases { - c := c t.Run(fmt.Sprintf("%v %v", c.a, c.b), func(t *testing.T) { t.Parallel()