Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Add option to watch testdata subdirectories #32

Open
sean-ahn opened this issue May 30, 2023 · 5 comments
Open

Proposal: Add option to watch testdata subdirectories #32

sean-ahn opened this issue May 30, 2023 · 5 comments

Comments

@sean-ahn
Copy link

Hello,

Firstly, kudos for your valuable contributions through the gow package.

Considering that the use of testdata directories is idiomatic in Go1, 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.

Best regards.

Footnotes

  1. For instance, see https://github.com/golang/go/tree/master/src/image/testdata

@mitranim
Copy link
Owner

Pretty sure this is already possible via -w=testdata. 🙂

@mitranim
Copy link
Owner

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.

@sean-ahn
Copy link
Author

sean-ahn commented Jun 1, 2023

@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. 🙂

@sean-ahn
Copy link
Author

sean-ahn commented Jun 1, 2023

Currently, I can currently do this with the command below:
gow -v -c -w $(find . -type d -name "testdata" | tr '\n' ',') test -race -v ./...

@mitranim
Copy link
Owner

mitranim commented Jun 6, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants