[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 <bjboreham@gmail.com>
This commit is contained in:
Bryan Boreham 2024-11-11 10:55:05 +00:00
parent 140f4aa9ae
commit de35a40ed5

View file

@ -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!")
}