Browse Source

[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
commit
de35a40ed5
  1. 10
      cmd/prometheus/main.go

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

Loading…
Cancel
Save