mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-19 02:17:09 +00:00
yaml.Marshal defaults to 4 spaces, and only the config package forced 2. Saving a plugin re-encodes the whole config.yaml, so installing one reindented a user's entire file; skill/agent frontmatter and audit-rules.yaml were written with 4 spaces too. Route all YAML writers (config, registry, plugins, MCP, frontmatter, audit rules) through one utils.MarshalYAML so they cannot drift apart.
14 lines
309 B
Go
14 lines
309 B
Go
package utils
|
|
|
|
import "testing"
|
|
|
|
func TestMarshalYAML_TwoSpaceIndent(t *testing.T) {
|
|
got, err := MarshalYAML(map[string]any{"a": map[string]any{"b": []string{"c"}}})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if want := "a:\n b:\n - c\n"; string(got) != want {
|
|
t.Errorf("got:\n%s\nwant:\n%s", got, want)
|
|
}
|
|
}
|