fix: add golangci-lint config and fix all lint errors
Some checks failed
CI / Lint (push) Successful in 58s
CI / Test (push) Successful in 1m15s
CI / Release (push) Successful in 6s
CI / Docker Build & Push (push) Failing after 23s
CI / Notify (push) Successful in 1s

- Add .golangci.yml with v2 config (errcheck, govet, staticcheck, misspell, etc.)
- Fix 32 errcheck issues across config, discord, ntfy, server packages
- Fix misspelling: cancelled → canceled
- Fix staticcheck: use append(slice...) instead of loop
- Fix staticcheck: remove empty error branch
- Use t.Setenv instead of os.Setenv/Unsetenv in tests
- Update CI workflow: add lint job, release tagging, ntfy notifications
This commit is contained in:
2026-02-14 09:15:01 -05:00
parent 8a80602d56
commit 1c1a9cc35f
12 changed files with 189 additions and 65 deletions

View File

@@ -13,7 +13,7 @@ func TestServer_HealthEndpoint_StatusCodes(t *testing.T) {
mux := http.NewServeMux()
mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.Write([]byte(`{"status":"ok","healthy":true}`))
_, _ = w.Write([]byte(`{"status":"ok","healthy":true}`))
})
req := httptest.NewRequest(http.MethodGet, "/health", nil)
@@ -35,7 +35,7 @@ func TestServer_ReadyEndpoint_StatusCodes(t *testing.T) {
mux := http.NewServeMux()
mux.HandleFunc("/ready", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.Write([]byte(`{"status":"ready","ready":true}`))
_, _ = w.Write([]byte(`{"status":"ready","ready":true}`))
})
req := httptest.NewRequest(http.MethodGet, "/ready", nil)
@@ -56,7 +56,7 @@ func TestServer_Shutdown(t *testing.T) {
}
// Start in background
go srv.ListenAndServe()
go func() { _ = srv.ListenAndServe() }()
// Give it a moment to start
time.Sleep(10 * time.Millisecond)
@@ -77,7 +77,7 @@ func TestServer_MetricsEndpoint(t *testing.T) {
mux := http.NewServeMux()
mux.HandleFunc("/metrics", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Write([]byte("# metrics here"))
_, _ = w.Write([]byte("# metrics here"))
})
req := httptest.NewRequest(http.MethodGet, "/metrics", nil)