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:
@@ -61,7 +61,7 @@ func (c *Client) Subscribe(ctx context.Context, msgCh chan<- Message) {
|
||||
err := c.connect(ctx, msgCh)
|
||||
if err != nil {
|
||||
if ctx.Err() != nil {
|
||||
return // Context cancelled
|
||||
return // Context canceled
|
||||
}
|
||||
slog.Error("ntfy connection failed", "error", err, "backoff", backoff)
|
||||
time.Sleep(backoff)
|
||||
@@ -90,7 +90,7 @@ func (c *Client) connect(ctx context.Context, msgCh chan<- Message) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("connect: %w", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
defer func() { _ = resp.Body.Close() }()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
body, _ := io.ReadAll(io.LimitReader(resp.Body, 1024))
|
||||
|
||||
Reference in New Issue
Block a user