code: func findMatchInFiles(fileiter *object.FileIter, treeName string, opts *GrepOptions) ([]GrepResult, error) {
  	var results []GrepResult
  
  	err := fileiter.ForEach(func(file *object.File) error {
  		var fileInPathSpec bool
  
  		// When no pathspecs are provided, search all the files.
  		if len(opts.PathSpecs) == 0 {
  			fileInPathSpec = true
  		}
  
  		// Check if the file name matches with the pathspec. Break out of the
  		// loop once a match is found.
  		for _, pathSpec := range opts.PathSpecs {
  			if pathSpec != nil && pathSpec.MatchString(file.Name) {
  				fileInPathSpec = true
  				break
  			}
  		}
  
  		// If the file does not match with any of the pathspec, skip it.
  		if !fileInPathSpec {
  			return nil
  		}
  
  		grepResults, err := findMatchInFile(file, treeName, opts)
  		if err != nil {
  			return err
  		}
  		results = append(results, grepResults...)
  
  		return nil
  	})
  
  	return results, err
  }
docs: // findMatchInFiles takes a FileIter, worktree name and GrepOptions, and
  // returns a slice of GrepResult containing the result of regex pattern matching
  // in content of all the files.