You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: factory.go
    path of file: ./repos/octant/internal/octant
    
    the code of the file until where you have to start completion: /*
Copyright (c) 2019 the Octant contributors. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/

package octant

import (
	"context"
	"path"
	"strings"
	"sync"

	"github.com/vmware-tanzu/octant/internal/util/path_util"

	"github.com/pkg/errors"
	"golang.org/x/sync/errgroup"

	"github.com/vmware-tanzu/octant/pkg/navigation"
	"github.com/vmware-tanzu/octant/pkg/store"
)

// EntriesFunc is a function that can create navigation entries.
type EntriesFunc func(ctx context.Context, prefix, namespace string, objectStore store.Store, 
    
func (nf *NavigationFactory) Generate(ctx context.Context, module string, wantsClusterScoped bool) ([]navigation.Navigation, error) {
	n := []navigation.Navigation{}

	var mu sync.Mutex
	var g errgroup.Group

	for index, name := range nf.entries.Order {
		g.Go(func() error {
			child, err := nf.genNode(ctx, name, nf.entries.EntriesFuncs[name], wantsClusterScoped)
			if err != nil {
				return errors.Wrapf(err, "generate entries for %s", name)
			}

			if iconName, ok := nf.entries.IconMap[name]; ok {
				child.IconName = iconName
			}

			// Setting module creates a divider in navigation
			if (module != "") && (index == 0) {
				child.Module = module
			}

			mu.Lock()
			n = append(n, *child)
			mu.Unlock()

			return nil
		})

		if err := g.Wait(); err != nil {
			return nil, err
		}

	}

	return n, nil
}