From 0a2f635d57e2ee85f9d59a324627bad641beb9b9 Mon Sep 17 00:00:00 2001 From: Aishwarya Lad <67022814+Aishwarya-Lad@users.noreply.github.com> Date: Wed, 26 Jun 2024 16:22:01 -0700 Subject: [PATCH] typos --- docker.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docker.go b/docker.go index 661dd53..61c137b 100644 --- a/docker.go +++ b/docker.go @@ -158,13 +158,17 @@ func (p Plugin) Exec() error { os.MkdirAll(dockerHome, 0600) path := filepath.Join(dockerHome, "config.json") - err := os.WriteFile(path, []byte(p.Login.Config), 0600) + file, err := os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0600) + if err != nil { + return fmt.Errorf("Error writing config.json: %s", err) + } + err = os.WriteFile(path, []byte(p.Login.Config), 0600) if err != nil { return fmt.Errorf("Error writing config.json: %s", err) } file.Close() } - + // add base image docker credentials to the existing config file, else create new if p.BaseImagePassword != "" { json, err := setDockerAuth(p.Login.Username, p.Login.Password, p.Login.Registry,