Skip to content

Commit bba6010

Browse files
committed
Use 2 space identation in yaml
Signed-off-by: Juan Antonio Osorio <[email protected]>
1 parent 114efc9 commit bba6010

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

cmd/import-from-toolhive/main.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
package main
33

44
import (
5+
"bytes"
56
"encoding/json"
67
"fmt"
78
"io"
@@ -191,11 +192,15 @@ func importEntry(name string, server *toolhiveRegistry.ImageMetadata, outputDir
191192
server.Name = name
192193
}
193194

194-
// Create YAML content with proper formatting
195-
yamlData, err := yaml.Marshal(server)
196-
if err != nil {
195+
// Create YAML content with proper formatting (2-space indentation)
196+
var buf bytes.Buffer
197+
encoder := yaml.NewEncoder(&buf)
198+
encoder.SetIndent(2)
199+
if err := encoder.Encode(server); err != nil {
197200
return fmt.Errorf("failed to marshal YAML: %w", err)
198201
}
202+
encoder.Close()
203+
yamlData := buf.Bytes()
199204

200205
// Add a header comment with metadata
201206
header := fmt.Sprintf(`# %s MCP Server Registry Entry

cmd/regup/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ func updateYAMLPreservingStructure(path string, stars, pulls int) error {
269269
// Marshal back preserving structure
270270
var buf bytes.Buffer
271271
encoder := yaml.NewEncoder(&buf)
272-
encoder.SetIndent(4)
272+
encoder.SetIndent(2)
273273
if err := encoder.Encode(&doc); err != nil {
274274
return fmt.Errorf("failed to encode YAML: %w", err)
275275
}

0 commit comments

Comments
 (0)