From 14a15e8b599e5beed66645552cff2187f6e7eb2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?=
Date: Wed, 25 Dec 2024 11:59:14 +0100 Subject: [PATCH] Prevent a data race --- acid.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/acid.go b/acid.go index bbe8ec8..8ff132e 100644 --- a/acid.go +++ b/acid.go @@ -22,6 +22,7 @@ import ( "os/exec" "os/signal" "path/filepath" + "slices" "sort" "strconv" "strings" @@ -314,9 +315,9 @@ func handleTask(w http.ResponseWriter, r *http.Request) { rt.DeployLog.mu.Lock() defer rt.DeployLog.mu.Unlock() - task.RunLog = rt.RunLog.b - task.TaskLog = rt.TaskLog.b - task.DeployLog = rt.DeployLog.b + task.RunLog = slices.Clone(rt.RunLog.b) + task.TaskLog = slices.Clone(rt.TaskLog.b) + task.DeployLog = slices.Clone(rt.DeployLog.b) }() if err := templateTask.Execute(w, &task); err != nil {