-
-
Notifications
You must be signed in to change notification settings - Fork 602
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
Numeric text data is getting mangled #245
Comments
..this is with yq version 2.4.0 |
So, I haven't looked at the source code yet, as I'm completely unfamiliar with Go, but looking at: ..I'm guessing that create/write/update actions add data using the %v format, which defaults to %g, which in turn defaults to %e for data interpreted as large exponents. Perhaps yq could get an optional --fmt=%x flag argument for reads/writes that would allow run-time control over how data is interpreted and expressed. For my purposes, above, --fmt=%s would do nicely, e.g.:
..to force $WPA_PSK to be interpreted as string data, not as a large number. For more complicated string data, fmt even supports %q, "a double-quoted string safely escaped with Go syntax", which presumably would allow reading and writing virtually string data. |
Actually,
..yields:
..which netplan is OK with. So maybe this isn't the show-stopper issue I thought it was. |
Simpler test case:
So I had this nice one-liner to bump my helm chart version, and suddenly it jumps from 0.9 to 0.1... |
This is a sneaky one! It bit me today when a commit sha happened to have only numbers:
Thanks for the workaround @gharris999 ! |
I've been bit by this as well, a fix would be much appreciated. |
Just released a new version of yaml that fixes this - it's a pretty significant update so it's still in beta: https://github.com/mikefarah/yq/releases/tag/3.0.0-beta |
Given:
..yields:
..which won't do, of course. I need to store that wifi passkey string so that it can be interpreted literally. The interpreting program, netplan, isn't going to know that it needs to convert that scientific notation back into a string.
The text was updated successfully, but these errors were encountered: