fix: remaining staticcheck QF1012 WriteString(Sprintf) violations

This commit is contained in:
Ed Zynda
2026-02-27 18:42:45 +03:00
parent 25a3523c56
commit c925a69aec
5 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -194,7 +194,7 @@ func generateDiff(path, old, new string, changeIdx int) string {
if i >= lineNum-1 && i < lineNum-1+countNewlines(old[changeIdx:])+1 {
prefix = "-"
}
diff.WriteString(fmt.Sprintf("%s %s\n", prefix, oldLines[i]))
fmt.Fprintf(&diff, "%s %s\n", prefix, oldLines[i])
}
return diff.String()
+1 -1
View File
@@ -82,7 +82,7 @@ func executeLs(ctx context.Context, call fantasy.ToolCall, workDir string) (fant
count := 0
for _, entry := range entries {
if count >= limit {
result.WriteString(fmt.Sprintf("\n[truncated: showing %d of %d entries]", limit, len(entries)))
fmt.Fprintf(&result, "\n[truncated: showing %d of %d entries]", limit, len(entries))
break
}
name := entry.Name()
+1 -1
View File
@@ -100,7 +100,7 @@ func executeRead(ctx context.Context, call fantasy.ToolCall, workDir string) (fa
var result strings.Builder
for i, line := range lines {
lineNum := offset + i + 1
result.WriteString(fmt.Sprintf("%d: %s\n", lineNum, line))
fmt.Fprintf(&result, "%d: %s\n", lineNum, line)
}
output := result.String()
+1 -1
View File
@@ -65,7 +65,7 @@ func (pb *PromptBuilder) Build() string {
buf.WriteString("\n\n")
}
if s.name != "" {
buf.WriteString(fmt.Sprintf("# %s\n\n", s.name))
fmt.Fprintf(&buf, "# %s\n\n", s.name)
}
buf.WriteString(s.content)
}
+3 -3
View File
@@ -216,11 +216,11 @@ func FormatForPrompt(skills []*Skill) string {
for _, s := range skills {
buf.WriteString(" <skill>\n")
buf.WriteString(fmt.Sprintf(" <name>%s</name>\n", s.Name))
fmt.Fprintf(&buf, " <name>%s</name>\n", s.Name)
if s.Description != "" {
buf.WriteString(fmt.Sprintf(" <description>%s</description>\n", s.Description))
fmt.Fprintf(&buf, " <description>%s</description>\n", s.Description)
}
buf.WriteString(fmt.Sprintf(" <location>file://%s</location>\n", s.Path))
fmt.Fprintf(&buf, " <location>file://%s</location>\n", s.Path)
buf.WriteString(" </skill>\n")
}