[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>
pull/15371/head
Bryan Boreham 2 weeks ago
parent 140f4aa9ae
commit de35a40ed5

@ -1369,10 +1369,12 @@ func main() {
}, },
) )
} }
if err := g.Run(); err != nil { func() { // This function exists so the top of the stack is named 'main.main.funcxxx' and not 'oklog'.
logger.Error("Error running goroutines from run.Group", "err", err) if err := g.Run(); err != nil {
os.Exit(1) logger.Error("Fatal error", "err", err)
} os.Exit(1)
}
}()
logger.Info("See you next time!") logger.Info("See you next time!")
} }

Loading…
Cancel
Save