From b0eb1ab2a1935f6201e5059d6d5d18c84267eac5 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Thu, 16 Oct 2025 09:44:04 +0200 Subject: [PATCH] chore(gallery agent): try fixing linting errors Signed-off-by: Ettore Di Giacinto --- .github/gallery-agent/gallery.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/gallery-agent/gallery.go b/.github/gallery-agent/gallery.go index 81cb28d31..8788fbf91 100644 --- a/.github/gallery-agent/gallery.go +++ b/.github/gallery-agent/gallery.go @@ -43,7 +43,19 @@ func generateYAMLEntry(model ProcessedModel, familyAnchor string) string { description = cleanTextContent(description) // Format description for YAML (indent each line and ensure no trailing spaces) - formattedDescription := strings.ReplaceAll(description, "\n", "\n ") + // Handle empty lines properly to avoid spaces-only lines + lines := strings.Split(description, "\n") + var formattedLines []string + for _, line := range lines { + if strings.TrimSpace(line) == "" { + // Empty line - don't add spaces + formattedLines = append(formattedLines, "") + } else { + // Non-empty line - add proper indentation + formattedLines = append(formattedLines, " "+line) + } + } + formattedDescription := strings.Join(formattedLines, "\n") // Remove any trailing spaces from the formatted description formattedDescription = strings.TrimRight(formattedDescription, " \t") yamlTemplate := "" @@ -60,7 +72,8 @@ func generateYAMLEntry(model ProcessedModel, familyAnchor string) string { files: - filename: %s sha256: %s - uri: huggingface://%s/%s` + uri: huggingface://%s/%s +` return fmt.Sprintf(yamlTemplate, familyAnchor, modelName, @@ -81,7 +94,8 @@ func generateYAMLEntry(model ProcessedModel, familyAnchor string) string { %s overrides: parameters: - model: %s` + model: %s +` return fmt.Sprintf(yamlTemplate, familyAnchor, modelName,