From 02fe08f70e226d16191029ba61d3f8feb10ee3da Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Wed, 30 Apr 2025 16:55:41 +0200 Subject: [PATCH] cmd/initContainer: Style fix Use a strings.Builder [1] instance instead of raw string literals for consistency. Fallout from 772b66bf3e962785730e55f6242fa74066de0743 [1] https://pkg.go.dev/strings#Builder https://github.com/containers/toolbox/pull/1636 --- src/cmd/initContainer.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/cmd/initContainer.go b/src/cmd/initContainer.go index 069c75e..ac9534b 100644 --- a/src/cmd/initContainer.go +++ b/src/cmd/initContainer.go @@ -551,15 +551,16 @@ func configureKerberos() error { return nil } - kcmConfigString := `# Written by Toolbx -# https://containertoolbx.org/ -# -# # To disable the KCM credential cache, comment out the following lines. - -[libdefaults] - default_ccache_name = KCM: -` + var builder strings.Builder + builder.WriteString("# Written by Toolbx\n") + builder.WriteString("# https://containertoolbx.org/\n") + builder.WriteString("#\n") + builder.WriteString("# # To disable the KCM credential cache, comment out the following lines.\n") + builder.WriteString("\n") + builder.WriteString("[libdefaults]\n") + builder.WriteString(" default_ccache_name = KCM:\n") + kcmConfigString := builder.String() kcmConfigBytes := []byte(kcmConfigString) if err := ioutil.WriteFile("/etc/krb5.conf.d/kcm_default_ccache", kcmConfigBytes, 0644); err != nil { return errors.New("failed to configure Kerberos to use KCM as the default credential cache")