Skip to content

Fix errcheck linting error in HTTP handler#7

Draft
Claude wants to merge 2 commits intomainfrom
claude/update-readme-and-release-0-0-2
Draft

Fix errcheck linting error in HTTP handler#7
Claude wants to merge 2 commits intomainfrom
claude/update-readme-and-release-0-0-2

Conversation

@Claude
Copy link
Copy Markdown
Contributor

@Claude Claude AI commented Mar 24, 2026

The fmt.Fprintf call in the root HTTP handler was not checking its error return value, causing golangci-lint errcheck to fail.

Changes:

  • Added error checking and logging for fmt.Fprintf in main HTTP handler
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
    if _, err := fmt.Fprintf(w, `<html>...</html>`, *metricsPath); err != nil {
        log.Printf("Error writing response: %v", err)
    }
})

This aligns with the project's linting configuration which only excludes errcheck for fmt.Fprintf in test files.

@Claude Claude AI changed the title [WIP] Update README and release version 0.0.2 Release v0.0.2 with enhanced session metrics Mar 24, 2026
@Claude Claude AI requested a review from JetSquirrel March 24, 2026 04:49
Check and log error return value from fmt.Fprintf in HTTP handler

Co-authored-by: JetSquirrel <20291255+JetSquirrel@users.noreply.github.com>
Agent-Logs-Url: https://github.com/JetSquirrel/openclaw_exporter/sessions/9509d652-4408-4aca-9d31-a545c68854a7
@Claude Claude AI changed the title Release v0.0.2 with enhanced session metrics Fix errcheck linting error in HTTP handler Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants