-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
os: ExpandEnv: Missing curly bracket at end of string substitutes var name whether or not env var is set #35752
Comments
|
It's not and it shouldn't. The code here points out that Concrete example: Running ExpandEnv over a YAML file whose last line looks like this:
will, IMHO, incorrectly clobber the password. |
Hmm, it's also not consistent, since when we can do I think it's better to just improve the document of ExpandEnv to indicate that the expansion follow the rule of shell expansion, invalid syntax will return empty string. |
I agree that we should mention this in the documentation and not change the behavior of the function. |
In another case Expand was fixed: |
There is no significant difference between See also #26135. That said, I think you are suggesting that for |
Change https://golang.org/cl/208857 mentions this issue: |
Yep. It's not even like ExpandEnv replaces |
I'm looking at picking up an issue for a first contribution, and it looks as though this is a candidate. Is that actively being addressed by anyone? It looks like there is still a decision to be made on the expected behaviour. |
What version of Go are you using (
go version
)?and
Does this issue reproduce with the latest release?
Yes. (Go Playground)
What operating system and processor architecture are you using (
go env
)?go env
Outputand
What did you do?
https://play.golang.org/p/GSfBKiZqj2L
What did you expect to see?
Either
or
What did you see instead?
The text was updated successfully, but these errors were encountered: