From 68db80a05adf5aea74f8bdc1ab7ab713c6732be7 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Tue, 25 Feb 2025 16:35:44 +0100 Subject: [PATCH] fix(yaml): set indentation to 2 spaces The replaced module gopkg.in/yaml.v3 enforce an indentation of 4 spaces, when 0 spaces are defined. This is sad, because the old behavior can not be reproduced. Instead of using 4 spaces for indentation, when `yamlEncoder.SetIndent(0)` is called, we call `yamlEncoder.SetIndent(2)` to use 2 spaces for indentation, because it is closer to 0 instead 4 spaces. --- cmd/root.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 0ceb5d5..808ddb0 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -100,12 +100,12 @@ func run(cmd *cobra.Command, args []string) error { defer f.Close() yamlEncoder := yaml.NewEncoder(f) - yamlEncoder.SetIndent(0) + yamlEncoder.SetIndent(2) return yamlEncoder.Encode(dockerComposeConfig) default: yamlEncoder := yaml.NewEncoder(os.Stdout) - yamlEncoder.SetIndent(0) + yamlEncoder.SetIndent(2) return yamlEncoder.Encode(dockerComposeConfig) }