diff --git a/pkg/loki/loki.go b/pkg/loki/loki.go index f3415d0fb98e..9fc21207cecd 100644 --- a/pkg/loki/loki.go +++ b/pkg/loki/loki.go @@ -70,15 +70,12 @@ type Loki struct { store chunk.Store httpAuthMiddleware middleware.Interface - - inited map[moduleName]struct{} } // New makes a new Loki. func New(cfg Config) (*Loki, error) { loki := &Loki{ - cfg: cfg, - inited: map[moduleName]struct{}{}, + cfg: cfg, } loki.setupAuthMiddleware() @@ -128,8 +125,6 @@ func (t *Loki) initModule(m moduleName) error { return errors.Wrap(err, fmt.Sprintf("error initialising module: %s", m)) } } - - t.inited[m] = struct{}{} return nil } @@ -161,5 +156,4 @@ func (t *Loki) stopModule(m moduleName) { level.Error(util.Logger).Log("msg", "error stopping", "module", m, "err", err) } } - delete(t.inited, m) } diff --git a/pkg/loki/modules.go b/pkg/loki/modules.go index 2a65916e7a73..1d0c6125ddc0 100644 --- a/pkg/loki/modules.go +++ b/pkg/loki/modules.go @@ -197,7 +197,7 @@ func orderedDeps(m moduleName) []moduleName { uniq[dep] = false } - result := make([]moduleName, 0) + result := make([]moduleName, 0, len(uniq)) // keep looping through all modules until they have all been added to the result.