cmd/seqls/manager.go
func (w *workManager) Process(rootPaths []string) error {
	if w.hasRun {
		return errors.New("Process() cannot be called more than once")
	}

	w.hasRun = true

	// Start the workers to find sequences
	var wg sync.WaitGroup
	for i := 0; i < numWorkers; i++ {
		wg.Add(1)
		go func() {
			// Processes work from the input chans
			// and places them into the output chans
			w.processSources()
			wg.Done()
		}()
	}

	// Load the root paths into the source channel
	go func() {
		if Options.Recurse {
			// Perform a recursive walk on all paths
			w.loadRecursive(rootPaths)
		} else {
			// Load each root path directly into chan
			w.load(rootPaths)
		}
		w.closeInputs()
	}()

	// Will close the output channel when no more source
	// paths are being added
	go func() {
		wg.Wait()
		w.closeOutput()
	}()

	// Pull out all processed sequences and print
	w.processResults()

	return nil
}
func (w *workManager) Process(rootPaths []string) error {
	if w.hasRun {
		return errors.New("Process() cannot be called more than once")
	}

	w.hasRun = true

	// Start the workers to find sequences
	var wg sync.WaitGroup
	for i := 0; i < numWorkers; i++ {
		wg.Add(1)
		go func() {
			// Processes work from the input chans
			// and places them into the output chans
			w.processSources()
			wg.Done()
		}()
	}

	// Load the root paths into the source channel
	go func() {
		if Options.Recurse {
			// Perform a recursive walk on all paths
			w.loadRecursive(rootPaths)
		} else {
			// Load each root path directly into chan
			w.load(rootPaths)
		}
		w.closeInputs()
	}()

	// Will close the output channel when no more source
	// paths are being added
	go func() {
		wg.Wait()
		w.closeOutput()
	}()

	// Pull out all processed sequences and print
	w.processResults()

	return nil
}
// Process method starts the workManager, by processing
// the rootPaths, and resolving file/sequence listings
// from them. Output is printed according to application
// Options.
// It is an error to call this method more than once.