From de35a40ed5d555700eb9356a693e49f9eee24943 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Mon, 11 Nov 2024 10:55:05 +0000 Subject: [PATCH] [REFACTOR] Small improvement to top-level naming Previously, top-level initialization (including WAL reading) had this at the top of the stack: github.com/oklog/run.(*Group).Run.func1:38 I found this confusing, and thought it had something to do with logging. Introducing another local function should make this clearer. Also make the error message user-centric not code-centric. Signed-off-by: Bryan Boreham --- cmd/prometheus/main.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go index ecf179ce5..493106e15 100644 --- a/cmd/prometheus/main.go +++ b/cmd/prometheus/main.go @@ -1369,10 +1369,12 @@ func main() { }, ) } - if err := g.Run(); err != nil { - logger.Error("Error running goroutines from run.Group", "err", err) - os.Exit(1) - } + func() { // This function exists so the top of the stack is named 'main.main.funcxxx' and not 'oklog'. + if err := g.Run(); err != nil { + logger.Error("Fatal error", "err", err) + os.Exit(1) + } + }() logger.Info("See you next time!") }