-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add wildcard for --target and family #8883
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8883 +/- ##
===========================================
- Coverage 59.33% 44.30% -15.04%
===========================================
Files 641 634 -7
Lines 99407 97211 -2196
Branches 1389 1389
===========================================
- Hits 58986 43065 -15921
- Misses 37056 51158 +14102
+ Partials 3365 2988 -377
Continue to review full report at Codecov.
|
// in the snapshot. URNs are returned in sorted order. All returned urns are unique. | ||
func (snap *Snapshot) GlobUrn(urn resource.URN) []resource.URN { | ||
if !strings.Contains(string(urn), "*") { | ||
return []resource.URN{urn} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case is bit weird. I think the weirdness comes from GlobUrn combining two distinct pieces of functionality - filtering snap.Resources
and matching against a pattern. This clause returns urn
even if it's not mentioned in snap.Resources
. You would think that the return values []resource.URN
are always a subset so this may be a little surprising. I'm guessing this is exactly what you want at the call sites but it's not obvious in the func itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think it would be fine for it to do that here. I don't think we have anything to tell the user "you targeted X for update but it wasn't found"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also how a normal glob function works (for example, in sh). Expanding an argument with no wild cards returns that argument, even if the argument is not a valid path.
$ echo *.txt
real_file.txt
$ echo fake.txt
fake.txt
Description
Fixes #5870
Checklist