Fix provider review findings

This commit is contained in:
“Naeel”
2026-08-31 20:19:31 +03:00
parent 75c868e0b5
commit 86871498a2
13 changed files with 327 additions and 141 deletions
@@ -4,7 +4,6 @@ package helpers
import (
"fmt"
"go/format"
"os"
"strings"
"unicode"
@@ -168,14 +167,13 @@ func EnsureGoIdent(s string) string {
return "R" + s
}
// FormatSourceOrWarn форматирует Go-код. При ошибке пишет warning в stderr.
func FormatSourceOrWarn(filePath string, src []byte) []byte {
// FormatSourceOrWarn форматирует Go-код и возвращает ошибку при сбое gofmt.
func FormatSourceOrWarn(filePath string, src []byte) ([]byte, error) {
formatted, err := format.Source(src)
if err != nil {
fmt.Fprintf(os.Stderr, "WARNING: gofmt failed for %s: %v — writing unformatted code\n", filePath, err)
return src
return nil, fmt.Errorf("gofmt failed for %s: %w", filePath, err)
}
return formatted
return formatted, nil
}
// PlanModifierType возвращает суффикс типа план-модификатора (Bool/Int64/String).