Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix lint: handle all unchecked error returns

Lebc503de2555
diff --git a/cdp.go b/cdp.go
index 62652ce1..07d70315 100644
--- a/cdp.go
+++ b/cdp.go
@@ -71,7 +71,7 @@ func typeByNodeID(ctx context.Context, backendNodeID int64, text string) error {
"functionDeclaration": "function() { this.scrollIntoViewIfNeeded(); }",
"arguments": []any{},
}
- chromedp.FromContext(ctx).Target.Execute(ctx, "Runtime.callFunctionOn", scrollP, nil)
+ _ = chromedp.FromContext(ctx).Target.Execute(ctx, "Runtime.callFunctionOn", scrollP, nil)
p := map[string]any{"backendNodeId": backendNodeID}
if err := chromedp.FromContext(ctx).Target.Execute(ctx, "DOM.focus", p, nil); err != nil {
diff --git a/handlers.go b/handlers.go
index edcf05f9..41b4834f 100644
--- a/handlers.go
+++ b/handlers.go
@@ -95,7 +95,7 @@ func (b *Bridge) handleSnapshot(w http.ResponseWriter, r *http.Request) {
b.mu.Unlock()
var url, title string
- chromedp.Run(tCtx,
+ _ = chromedp.Run(tCtx,
chromedp.Location(&url),
chromedp.Title(&title),
)
@@ -183,7 +183,7 @@ func (b *Bridge) handleText(w http.ResponseWriter, r *http.Request) {
}
var url, title string
- chromedp.Run(tCtx,
+ _ = chromedp.Run(tCtx,
chromedp.Location(&url),
chromedp.Title(&title),
)
@@ -233,7 +233,7 @@ func (b *Bridge) handleNavigate(w http.ResponseWriter, r *http.Request) {
b.mu.Unlock()
var url, title string
- chromedp.Run(tCtx,
+ _ = chromedp.Run(tCtx,
chromedp.Location(&url),
chromedp.Title(&title),
)
@@ -433,7 +433,7 @@ func (b *Bridge) handleTab(w http.ResponseWriter, r *http.Request) {
b.mu.Unlock()
var curURL, title string
- chromedp.Run(ctx, chromedp.Location(&curURL), chromedp.Title(&title))
+ _ = chromedp.Run(ctx, chromedp.Location(&curURL), chromedp.Title(&title))
jsonResp(w, 200, map[string]any{"tabId": newTargetID, "url": curURL, "title": title})
case tabActionClose:
diff --git a/middleware_test.go b/middleware_test.go
index 672151c8..c3bc1a64 100644
--- a/middleware_test.go
+++ b/middleware_test.go
@@ -19,7 +19,7 @@ func TestJsonResp(t *testing.T) {
t.Errorf("expected application/json, got %s", ct)
}
var body map[string]string
- json.NewDecoder(w.Body).Decode(&body)
+ _ = json.NewDecoder(w.Body).Decode(&body)
if body["status"] != "ok" {
t.Errorf("expected ok, got %s", body["status"])
}
@@ -33,7 +33,7 @@ func TestJsonErr(t *testing.T) {
t.Errorf("expected 500, got %d", w.Code)
}
var body map[string]string
- json.NewDecoder(w.Body).Decode(&body)
+ _ = json.NewDecoder(w.Body).Decode(&body)
if body["error"] != "something broke" {
t.Errorf("expected 'something broke', got %s", body["error"])
}
diff --git a/state.go b/state.go
index acecb35e..fe03adf1 100644
--- a/state.go
+++ b/state.go
@@ -117,7 +117,7 @@ func (b *Bridge) RestoreState() {
go func(tabCtx context.Context, url string) {
tCtx, tCancel := context.WithTimeout(tabCtx, 10*time.Second)
defer tCancel()
- chromedp.Run(tCtx, chromedp.ActionFunc(func(ctx context.Context) error {
+ _ = chromedp.Run(tCtx, chromedp.ActionFunc(func(ctx context.Context) error {
p := map[string]any{"url": url}
return chromedp.FromContext(ctx).Target.Execute(ctx, "Page.navigate", p, nil)
}))