gow
gow copied to clipboard
Proposal: Add option to watch `testdata` subdirectories
Hello,
Firstly, kudos for your valuable contributions through the gow package.
Considering that the use of testdata directories is idiomatic in Go[^1], introducing an option such as --testdata to automatically monitor all testdata subdirectories within the current watch directory could be beneficial.
Please feel free to correct me if my understanding of the gow's capabilities is inaccurate.
[^1]: For instance, see https://github.com/golang/go/tree/master/src/image/testdata
Best regards.
Pretty sure this is already possible via -w=testdata. 🙂
Minor correction: -w would require you to list the path to each testdata (either comma-separated or by repeating the -w flag with another value). There's currently no support for specifying path patterns. It could be added if desired.
@mitranim, thank you for your support! IMO, it would significantly enhance the utility of gow if it could support glob patterns for specifying file paths to watch. This feature could be handy, especially in larger codebases where numerous testdata subdirectories could be present. Could you consider adding this feature? Is it feasible? Also, I'm open to contributing to this work directly if possible. 🙂
Currently, I can currently do this with the command below:
gow -v -c -w $(find . -type d -name "testdata" | tr '\n' ',') test -race -v ./...
I have a tentative local implementation that would add new flags -W (counterpart to -w) and -I (counterpart to -i) that use filepath.Match for glob-like functionality. It supports * to match arbitrary names, but doesn't support matching arbitrary sub-paths via **. Would that satisfy your use case, or is it insufficient?