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
Simplify grep regexp to be more compatible #10765
Conversation
The new expression also works with the BSD implementation of grep. Also, I believe the expression did not work consistently for all possible version numers, for example a two digit patch version would not have been matched.
It does not work on single-digit minor version: echo 'go version go2.0 linux/amd64' | grep -Eo '[0-9]+\.?[0-9]+\.?[0-9]+' |
That is correct. Both Go and Node report three-part version numbers, so it shouldn't be a problem. Would you prefer:
Allowing single-part version numbers would also report |
Go reports 2-part version and Node 3-part but I'd like it to work on all variations between 1 and 3. These should all work:
BTW, my version of bsd grep ( |
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.
Blocking for now
Why is the trailing space relevant? To deselect |
Yes it's for that. I don't like this whole grep business, maybe there are better alternatives to get the version directly. For node, one can do:
Don't know about go, thought. |
|
Suggestion to not use $ go version | cut -c14- | cut -d ' ' -f1
1.14
$ node -p process.versions.node
12.16.1 The Edited: Updated node to just use |
Codecov Report
@@ Coverage Diff @@
## master #10765 +/- ##
==========================================
+ Coverage 43.53% 43.56% +0.02%
==========================================
Files 589 589
Lines 82658 82658
==========================================
+ Hits 35983 36006 +23
+ Misses 42199 42181 -18
+ Partials 4476 4471 -5
Continue to review full report at Codecov.
|
Apparently go's release tags can also have suffixes like go version | grep -Eo '[0-9]+\.[0-9.]+' This assumes there will never be a single digit version, but I think that is safe to assume. |
It starts with go, so I'd suggest: |
Please resolve conflict |
Oh, damn, sorry @silverwind I did not see that you requested changes |
It's fine. I should have cleared that anyways. |
The new expression also works with the BSD implementation of grep, instead of just GNU grep.
Also, I believe the expression did not work consistently for all possible
version numbers, for example a two digit patch version would not have
been matched.