mirror of
https://github.com/mark3labs/kit.git
synced 2026-06-14 03:30:26 +00:00
fix: remaining staticcheck QF1012 WriteString(Sprintf) violations
This commit is contained in:
@@ -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
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user