style: use fmt.Fprintf instead of WriteString(fmt.Sprintf) (staticcheck QF1012)

Mechanical fix applied by golangci-lint --fix. Pre-existing debt that fails the staticcheck QF1012 quickfix check; no behavior change. Clears the lint gate so subsequent commits in this package set pass.
This commit is contained in:
2026-06-20 00:33:30 +01:00
parent aa7d884b0c
commit e11f140997
7 changed files with 45 additions and 45 deletions
+5 -5
View File
@@ -77,24 +77,24 @@ func (e *StructuredError) Error() string {
var sb strings.Builder
// Error code and message
sb.WriteString(fmt.Sprintf("[%d] %s", e.Code, e.Message))
fmt.Fprintf(&sb, "[%d] %s", e.Code, e.Message)
// Context if available
if len(e.Context) > 0 {
sb.WriteString("\nContext:")
for k, v := range e.Context {
sb.WriteString(fmt.Sprintf("\n %s: %v", k, v))
fmt.Fprintf(&sb, "\n %s: %v", k, v)
}
}
// Remediation if available
if e.Remediation != "" {
sb.WriteString(fmt.Sprintf("\nHow to fix: %s", e.Remediation))
fmt.Fprintf(&sb, "\nHow to fix: %s", e.Remediation)
}
// Underlying cause if available
if e.Cause != nil {
sb.WriteString(fmt.Sprintf("\nCaused by: %v", e.Cause))
fmt.Fprintf(&sb, "\nCaused by: %v", e.Cause)
}
return sb.String()
@@ -215,7 +215,7 @@ func captureStack(skip int) string {
for {
frame, more := frames.Next()
if !strings.Contains(frame.File, "runtime/") {
sb.WriteString(fmt.Sprintf("\n %s:%d %s", frame.File, frame.Line, frame.Function))
fmt.Fprintf(&sb, "\n %s:%d %s", frame.File, frame.Line, frame.Function)
}
if !more {
break