File extractor service

File extractor provides you a simple function to search in a path recursively and find terms based on a regular expression.

Register the service into your main.go file:

registry.ServiceProviderExtractor(),
1

Access the service:

service.DI().FileExtractorService()
1

Extract phrase (errors in this example):

errorTerms, err := extractService.Extract(fileextractor.ExtractParams{
  SearchPath: "./",
  Excludes:   []string{},
  Expression: `errors.New[(]*\("([^)]*)"\)`,
})
if err != nil {
  // handle error
}
1
2
3
4
5
6
7
8