-
Notifications
You must be signed in to change notification settings - Fork 212
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
bool flag caused a panic #1215
Comments
I couldn't understand what this statement saying. may be lack of context ?? Yaml 1.2 dropped boolean representations ( ref: go-yaml/yaml#214 |
line 89 is casting an untyped yaml key unconditionally to a string, when yaml keys can also be integers or booleans. I believe even after upgrading to v3, someone could make a key using true/false or a number and the line below would panic, right? Previously I had a workaround that would force the string representation of the key, using I am still quite interested in upgrading to go-yaml v3 though for this other issue #1019, as it will allow us to get line numbers for our linter. But I don't think the upgrade will make this part of the code safe from panics. Let me know if you see it differently though! 😀 |
Agreed. If we need keys as strings, then why not just use |
Describe the bug
I passed an empty bool flag to a mixin and it caused a panic when it executed.
To Reproduce
This also panics:
Expected behavior
Definitely not a panic, at least an error if I should have used different formatting. Ideally it should pass my flag appropriately, e.g.
--yes
.Porter Command and Output
Version
porter v0.27.2 (aee93e9)
The code on this line used to use
fmt.Sprintf("%v"....)
shenanigans here to convert the key to a string to avoid yaml's typing of keys as int and bools. What's happening is that yaml is interpreting "yes" or "y" as a bool, not a string. I was able to force it to a string in the yaml by changing it to"yes":
We should go back to the old hack and comment why it's there with a test so that I'm not tempted to remove it again. 😊
The text was updated successfully, but these errors were encountered: