From 3cc8774eb3be845e27e7fd1e2cdd514d7eddb4d1 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Fri, 19 Jan 2024 16:35:36 +1100 Subject: [PATCH] Fix race in ExportStatusWriter --- internal/testutil/status_writer.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/testutil/status_writer.go b/internal/testutil/status_writer.go index ac872d57c0..bcc5c2b5d6 100644 --- a/internal/testutil/status_writer.go +++ b/internal/testutil/status_writer.go @@ -40,7 +40,9 @@ func ExportStatusWriter(sw StatusWriter, path string, t testing.TB) (release fun http.HandleFunc( pattern, func(w http.ResponseWriter, r *http.Request) { + mu.Lock() sw := sws[pattern] + mu.Unlock() if sw == nil { http.NotFound(w, r) return