func (s *Scanner) Scan() error {
	err := filepath.Walk(s.Directory, s.scan)
	if err != nil {
		return err
	}
	if s.Keywords[0] == "" {
		var foundFiles []string
		for _, fileInfo := range s.MatchedFilePaths {
			foundFiles = append(foundFiles, fileInfo.Path)
		}
		fmt.Println(strings.Join(foundFiles, "\n"))
	} else {
		var wg sync.WaitGroup
		for _, chunk := range eachSlice(s.MatchedFilePaths) {
			matchedCount := len(chunk)
			wg.Add(matchedCount)
			for _, match := range chunk {
				go func(m FileData) {
					s.parse(m)
					wg.Done()
				}(match)
			}
			wg.Wait()
		}
	}
	fmt.Println(strings.Join(s.KeywordMatches, "\n"))
	return nil
}
Scan walks the given directory tree and stores all matching files into a slice
package scnnr
import (
	"bufio"
	"fmt"
	"log"
	"os"
	"path/filepath"
	"regexp"
	"strings"
	"sync"
)
type Scanner struct {
	sync.Mutex
	Regex            bool
	Directory        string
	FileExtensions   []string
	Keywords         []string
	KeywordMatches   []string
	MatchedFilePaths []FileData
}
type FileData struct {
	Path string
	Info os.FileInfo
}