September 2017
Intermediate to advanced
466 pages
9h 33m
English
This section will illustrate how to add support for regular expressions in finalFind.go: the name of the last version of the tool will be regExpFind.go. The new flag will be called -re and it will require a string value: anything that matches this string value will be included in the output unless it is excluded by another command-line option. Additionally, due to the flexibility that flags offer, we do not need to delete any of the previous options in order to add another one!
Once again, the diff(1) command will tell us the code differences between regExpFind.go and finalFind.go:
$ diff regExpFind.go finalFind.go
8d7
< "regexp"
36,44d34
< func regularExpression(path, regExp string) bool {
< if regExp == "" {
Read now
Unlock full access