fix: resolve lint issues (govet shadow, golines, gci formatting)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f101a977d3
commit
51f08e7f50
3 changed files with 12 additions and 9 deletions
|
|
@ -544,8 +544,8 @@ func (al *AgentLoop) ocrPDF(
|
||||||
"cmd": ocrCfg.Command,
|
"cmd": ocrCfg.Command,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err := cmd.Start(); err != nil {
|
if startErr := cmd.Start(); startErr != nil {
|
||||||
logger.WarnCF("agent", "Failed to start OCR command", map[string]any{"error": err.Error()})
|
logger.WarnCF("agent", "Failed to start OCR command", map[string]any{"error": startErr.Error()})
|
||||||
return fmt.Sprintf("[file:%s]", pdfPath)
|
return fmt.Sprintf("[file:%s]", pdfPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -560,10 +560,10 @@ func (al *AgentLoop) ocrPDF(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cmd.Wait(); err != nil {
|
if waitErr := cmd.Wait(); waitErr != nil {
|
||||||
logger.WarnCF("agent", "OCR command failed", map[string]any{
|
logger.WarnCF("agent", "OCR command failed", map[string]any{
|
||||||
"path": pdfPath,
|
"path": pdfPath,
|
||||||
"error": err.Error(),
|
"error": waitErr.Error(),
|
||||||
})
|
})
|
||||||
return fmt.Sprintf("[file:%s]", pdfPath)
|
return fmt.Sprintf("[file:%s]", pdfPath)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -247,10 +247,10 @@ type AgentDefaults struct {
|
||||||
|
|
||||||
// OCRConfig configures the external OCR command for PDF text extraction.
|
// OCRConfig configures the external OCR command for PDF text extraction.
|
||||||
type OCRConfig struct {
|
type OCRConfig struct {
|
||||||
Command string `json:"command"` // path to OCR binary (e.g. "/path/to/.venv/bin/yomitoku")
|
Command string `json:"command"`
|
||||||
Args []string `json:"args,omitempty"` // static arguments (e.g. ["-f", "md", "--lite", ...])
|
Args []string `json:"args,omitempty"`
|
||||||
Env map[string]string `json:"env,omitempty"` // extra environment variables (e.g. {"HF_HOME": "/tmp/hf-home"})
|
Env map[string]string `json:"env,omitempty"`
|
||||||
Timeout int `json:"timeout,omitempty"` // timeout in seconds (default: 600)
|
Timeout int `json:"timeout,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetOCRTimeout returns the configured timeout or default (600s = 10min).
|
// GetOCRTimeout returns the configured timeout or default (600s = 10min).
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,10 @@ func (c *Cache) List(entryType string) ([]ListEntry, error) {
|
||||||
var entries []ListEntry
|
var entries []ListEntry
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var e ListEntry
|
var e ListEntry
|
||||||
if err := rows.Scan(&e.Hash, &e.Type, &e.Result, &e.FilePath, &e.Pages, &e.CreatedAt, &e.AccessedAt); err != nil {
|
if err := rows.Scan(
|
||||||
|
&e.Hash, &e.Type, &e.Result, &e.FilePath,
|
||||||
|
&e.Pages, &e.CreatedAt, &e.AccessedAt,
|
||||||
|
); err != nil {
|
||||||
return entries, err
|
return entries, err
|
||||||
}
|
}
|
||||||
entries = append(entries, e)
|
entries = append(entries, e)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue