fix: add golangci-lint config and fix all lint errors
- 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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user