@@ -100,7 +100,7 @@ func (c *Client) ExecuteLua(ctx context.Context, script string, timeout int) (*L
if err != nil {
return nil, fmt.Errorf("executing lua: %w", err)
}
- defer resp.Body.Close()
+ defer func() { _ = resp.Body.Close() }()
body, err := io.ReadAll(resp.Body)
if err != nil {
@@ -143,7 +143,7 @@ func (c *Client) Screenshot(ctx context.Context) ([]byte, error) {
if err != nil {
return nil, fmt.Errorf("fetching screenshot: %w", err)
}
- defer resp.Body.Close()
+ defer func() { _ = resp.Body.Close() }()
if resp.StatusCode != http.StatusOK {
body, _ := io.ReadAll(resp.Body)
@@ -194,7 +194,7 @@ func (c *Client) ConsoleLogs(ctx context.Context, limit int, since int64) (*Logs
if err != nil {
return nil, fmt.Errorf("fetching logs: %w", err)
}
- defer resp.Body.Close()
+ defer func() { _ = resp.Body.Close() }()
body, err := io.ReadAll(resp.Body)
if err != nil {
@@ -269,7 +269,7 @@ func (c *Client) ensureSessionCookie(req *http.Request) error {
if err != nil {
return fmt.Errorf("login request failed: %w", err)
}
- defer loginResp.Body.Close()
+ defer func() { _ = loginResp.Body.Close() }()
if loginResp.StatusCode != http.StatusOK {
return fmt.Errorf("login failed with status %d", loginResp.StatusCode)
@@ -60,7 +60,7 @@ func TestExecuteLua(t *testing.T) {
}
result := LuaResult{Result: json.RawMessage(`2`)}
- json.NewEncoder(w).Encode(result)
+ _ = json.NewEncoder(w).Encode(result)
})
srv := newTestServer(mux)
@@ -82,7 +82,7 @@ func TestExecuteLuaError(t *testing.T) {
mux.HandleFunc("/.runtime/lua_script", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusInternalServerError)
- fmt.Fprintf(w, `{"error":"attempt to call nil value"}`)
+ _, _ = fmt.Fprintf(w, `{"error":"attempt to call nil value"}`)
})
srv := newTestServer(mux)
@@ -107,7 +107,7 @@ func TestExecuteLuaTimeoutHeader(t *testing.T) {
t.Errorf("expected X-Timeout 60, got %s", timeout)
}
result := LuaResult{Result: json.RawMessage(`"ok"`)}
- json.NewEncoder(w).Encode(result)
+ _ = json.NewEncoder(w).Encode(result)
})
srv := newTestServer(mux)
@@ -129,7 +129,7 @@ func TestExecuteLuaTimeoutClamp(t *testing.T) {
t.Errorf("expected X-Timeout 21600, got %s", timeout)
}
result := LuaResult{Result: json.RawMessage(`"ok"`)}
- json.NewEncoder(w).Encode(result)
+ _ = json.NewEncoder(w).Encode(result)
})
srv := newTestServer(mux)
@@ -149,7 +149,7 @@ func TestScreenshot(t *testing.T) {
t.Errorf("expected GET, got %s", r.Method)
}
w.Header().Set("Content-Type", "image/png")
- w.Write([]byte("fake-png-data"))
+ _, _ = w.Write([]byte("fake-png-data"))
})
srv := newTestServer(mux)
@@ -187,7 +187,7 @@ func TestConsoleLogs(t *testing.T) {
{Level: "info", Text: "Ready", Timestamp: 1710000000050},
},
}
- json.NewEncoder(w).Encode(logs)
+ _ = json.NewEncoder(w).Encode(logs)
})
srv := newTestServer(mux)
@@ -216,7 +216,7 @@ func TestConsoleLogsDefaultLimit(t *testing.T) {
t.Errorf("expected default limit=100, got %s", limit)
}
logs := LogsResult{Logs: []LogEntry{}}
- json.NewEncoder(w).Encode(logs)
+ _ = json.NewEncoder(w).Encode(logs)
})
srv := newTestServer(mux)
@@ -247,7 +247,7 @@ func TestBasicAuth(t *testing.T) {
}
result := LuaResult{Result: json.RawMessage(`"ok"`)}
- json.NewEncoder(w).Encode(result)
+ _ = json.NewEncoder(w).Encode(result)
})
srv := newTestServer(mux)
@@ -268,7 +268,7 @@ func TestBearerToken(t *testing.T) {
t.Errorf("expected Bearer token, got %s", auth)
}
result := LuaResult{Result: json.RawMessage(`"ok"`)}
- json.NewEncoder(w).Encode(result)
+ _ = json.NewEncoder(w).Encode(result)
})
srv := newTestServer(mux)
@@ -299,7 +299,7 @@ func TestBothAuth(t *testing.T) {
t.Errorf("expected cookie value 'mock-jwt-token', got %s", cookie.Value)
}
result := LuaResult{Result: json.RawMessage(`"ok"`)}
- json.NewEncoder(w).Encode(result)
+ _ = json.NewEncoder(w).Encode(result)
})
srv := newTestServer(mux)