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

@@ -116,10 +116,7 @@ func FuzzWebhookPayloadJSON(f *testing.F) {
}
// Marshaling should not panic
_, err := json.Marshal(payload)
if err != nil {
// JSON encoding errors are acceptable for invalid UTF-8
// but should not panic
}
// Marshaling should not panic; JSON encoding errors are acceptable for invalid UTF-8
_, _ = json.Marshal(payload)
})
}

View File

@@ -117,7 +117,7 @@ func (c *Client) Send(ctx context.Context, webhookURL string, msg ntfy.Message)
if err != nil {
return fmt.Errorf("send request: %w", err)
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()
// Handle rate limiting
if resp.StatusCode == http.StatusTooManyRequests {