From bfc6981391e21be8c842fa48ed6bb332ebff8925 Mon Sep 17 00:00:00 2001 From: Yanujz Date: Sun, 20 Sep 2026 12:09:04 +0200 Subject: [PATCH] Pre-public hygiene: drop dead field, ignore config.json, silence errcheck Remove the unused thresholdObserver.seen field, stop config.json from being accidentally committed with live secrets, and use explicit error-ignoring forms where golangci-lint errcheck flags (behavior identical). golangci-lint is now silent on internal/... and cmd/... Fixes #68 --- .gitignore | 1 + internal/prober/prober_test.go | 4 ++-- internal/scheduler/scheduler_threshold_test.go | 5 ++--- internal/store/sqlite/sqlite.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index b03c0cb..59873fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /epmon epmon.db* config.yaml +config.json data/ diff --git a/internal/prober/prober_test.go b/internal/prober/prober_test.go index 5c43c6a..62b7ab1 100644 --- a/internal/prober/prober_test.go +++ b/internal/prober/prober_test.go @@ -29,7 +29,7 @@ func svc(url string) config.Service { func TestProbeUp(t *testing.T) { srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { - w.Write([]byte("hello world")) + _, _ = w.Write([]byte("hello world")) })) defer srv.Close() @@ -47,7 +47,7 @@ func TestProbeUp(t *testing.T) { func TestProbeDownCases(t *testing.T) { srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.URL.Path == "/missing-body" { - w.Write([]byte("nope")) + _, _ = w.Write([]byte("nope")) return } w.WriteHeader(500) diff --git a/internal/scheduler/scheduler_threshold_test.go b/internal/scheduler/scheduler_threshold_test.go index 8d4a344..4e6d7c9 100644 --- a/internal/scheduler/scheduler_threshold_test.go +++ b/internal/scheduler/scheduler_threshold_test.go @@ -19,9 +19,8 @@ type thresholdObservation struct { // thresholdObserver captures every ObserveProbe call in order. type thresholdObserver struct { - mu sync.Mutex - obs []thresholdObservation - seen int + mu sync.Mutex + obs []thresholdObservation } func (o *thresholdObserver) ObserveCheck(string, bool, int64) {} diff --git a/internal/store/sqlite/sqlite.go b/internal/store/sqlite/sqlite.go index a23dfb8..d514a0c 100644 --- a/internal/store/sqlite/sqlite.go +++ b/internal/store/sqlite/sqlite.go @@ -115,7 +115,7 @@ func (s *Store) SyncServices(ctx context.Context, services []store.ServiceMeta, if err != nil { return err } - defer tx.Rollback() + defer func() { _ = tx.Rollback() }() for _, svc := range services { if _, err := tx.ExecContext(ctx, `INSERT INTO services(id, name, url, updated_at) VALUES(?,?,?,?)