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:
@@ -80,7 +80,7 @@ func TestClient_Subscribe_ReceivesMessages(t *testing.T) {
|
||||
|
||||
for _, msg := range messages {
|
||||
data, _ := json.Marshal(msg)
|
||||
fmt.Fprintf(w, "%s\n", data)
|
||||
_, _ = fmt.Fprintf(w, "%s\n", data)
|
||||
}
|
||||
}))
|
||||
defer server.Close()
|
||||
@@ -134,7 +134,7 @@ func TestClient_Subscribe_FilterEvents(t *testing.T) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
for _, msg := range messages {
|
||||
data, _ := json.Marshal(msg)
|
||||
fmt.Fprintf(w, "%s\n", data)
|
||||
_, _ = fmt.Fprintf(w, "%s\n", data)
|
||||
}
|
||||
}))
|
||||
defer server.Close()
|
||||
@@ -194,7 +194,7 @@ func TestClient_Subscribe_ContextCancellation(t *testing.T) {
|
||||
func TestClient_connect_ServerError(t *testing.T) {
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
w.Write([]byte("internal error"))
|
||||
_, _ = w.Write([]byte("internal error"))
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
@@ -218,7 +218,7 @@ func TestClient_connect_URLConstruction(t *testing.T) {
|
||||
defer server.Close()
|
||||
|
||||
client := NewClient(server.URL, []string{"alerts", "updates"})
|
||||
client.connect(context.Background(), make(chan Message))
|
||||
_ = client.connect(context.Background(), make(chan Message))
|
||||
|
||||
expected := "/alerts,updates/json"
|
||||
if requestedURL != expected {
|
||||
|
||||
Reference in New Issue
Block a user