Fix errcheck and ineffassign lint errors
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -92,7 +92,7 @@ func blockingCallLLM(ctx context.Context, agent *Agent, req *llm.ChatCompletionR
|
|||||||
if sErr != nil {
|
if sErr != nil {
|
||||||
return nil, err // return the original error
|
return nil, err // return the original error
|
||||||
}
|
}
|
||||||
defer stream.Close()
|
defer func() { _ = stream.Close() }()
|
||||||
|
|
||||||
acc := llm.NewStreamAccumulator(stream)
|
acc := llm.NewStreamAccumulator(stream)
|
||||||
for acc.Next() {
|
for acc.Next() {
|
||||||
@@ -447,8 +447,6 @@ func coreLoop(ctx context.Context, startAgent *Agent, inputMessages []llm.Messag
|
|||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
emptyOutputRetries = 0
|
|
||||||
|
|
||||||
if err := runOutputGuardrails(ctx, s.agent, resp.Message); err != nil {
|
if err := runOutputGuardrails(ctx, s.agent, resp.Message); err != nil {
|
||||||
return s.finishRun(ctx, nil, err)
|
return s.finishRun(ctx, nil, err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ func DownloadPDFTool() agent.Tool {
|
|||||||
ErrorDetail: fmt.Sprintf("cannot create temp dir: %s", err),
|
ErrorDetail: fmt.Sprintf("cannot create temp dir: %s", err),
|
||||||
}), nil
|
}), nil
|
||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer func() { _ = os.RemoveAll(tmpDir) }()
|
||||||
|
|
||||||
tmpFile := filepath.Join(tmpDir, "input.pdf")
|
tmpFile := filepath.Join(tmpDir, "input.pdf")
|
||||||
if err := os.WriteFile(tmpFile, body, 0o600); err != nil {
|
if err := os.WriteFile(tmpFile, body, 0o600); err != nil {
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ func FetchSitemapTool() agent.Tool {
|
|||||||
ErrorDetail: fmt.Sprintf("cannot decompress gzipped sitemap: %s", err),
|
ErrorDetail: fmt.Sprintf("cannot decompress gzipped sitemap: %s", err),
|
||||||
}), nil
|
}), nil
|
||||||
}
|
}
|
||||||
defer gz.Close()
|
defer func() { _ = gz.Close() }()
|
||||||
reader = gz
|
reader = gz
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ func queryWhois(ctx context.Context, server, domain string) (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("cannot connect to %s: %w", server, err)
|
return "", fmt.Errorf("cannot connect to %s: %w", server, err)
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
defer func() { _ = conn.Close() }()
|
||||||
|
|
||||||
_ = conn.SetDeadline(time.Now().Add(10 * time.Second))
|
_ = conn.SetDeadline(time.Now().Add(10 * time.Second))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user