You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--- update: Retracting this comment. registry.ExpandString is sufficient for our needs, even though it has some limitations as described in #24848
I am re-submitting #5177 and #24848. In particular, there is no built-in function to expand Windows-style env vars (e.g. "%PROGRAMFILES%").
Why does the Go team refuse to fix this? Golang is supposed to support Windows. Forcing Windows users to adopt non-windows conventions is not what "support" means. We can't build a product with Go and then tell our customers' IT teams "You need to change the way that you reference environment vars because the Golang team refuses to recognize "%PROGRAMFILES%" as an environment variable even when running on Windows".
To revisit some points raised before:
"according to docs, os.ExpandEnv will only expand $name and ${name}". Nice to know but does not address the problem. golang could always provide another alternative such as @jeffreydwalter's suggestion to provide e.g. ExpandWinEnv.
"there are alternatives like golang.org/x/sys/windows/registry.ExpandString". Unless something has changed, registry.ExpandString doesn't work for this purpose (see #24848)
"there's an easier workaround here - simply replacing %FOO% with ${FOO}". It is a difficult proposition for anyone developing with Go to tell their corporate clients that they need to remember that just for their product, they need to change the way that they reference environment variables in strings.
We're rolling our own solution for now, but it would be much appreciate if you would reconsider offering some os-package function that provided env var expansion for windows-style conventions (even if it was as simple as a wrapper for the native ExpandEnvironmentStrings function)
The text was updated successfully, but these errors were encountered:
ALTree
changed the title
Golang provides *no native way* to expand Windows env vars
Go provides *no native way* to expand Windows env vars
Jan 22, 2021
--- update: Retracting this comment. registry.ExpandString is sufficient for our needs, even though it has some limitations as described in #24848
I am re-submitting #5177 and #24848. In particular, there is no built-in function to expand Windows-style env vars (e.g. "%PROGRAMFILES%").Why does the Go team refuse to fix this? Golang is supposed to support Windows. Forcing Windows users to adopt non-windows conventions is not what "support" means. We can't build a product with Go and then tell our customers' IT teams "You need to change the way that you reference environment vars because the Golang team refuses to recognize "%PROGRAMFILES%" as an environment variable even when running on Windows".
To revisit some points raised before:
"according to docs, os.ExpandEnv will only expand$name and $ {name}". Nice to know but does not address the problem. golang could always provide another alternative such as @jeffreydwalter's suggestion to provide e.g. ExpandWinEnv.
"there are alternatives like golang.org/x/sys/windows/registry.ExpandString". Unless something has changed, registry.ExpandString doesn't work for this purpose (see #24848)
"there's an easier workaround here - simply replacing %FOO% with ${FOO}". It is a difficult proposition for anyone developing with Go to tell their corporate clients that they need to remember that just for their product, they need to change the way that they reference environment variables in strings.
We're rolling our own solution for now, but it would be much appreciate if you would reconsider offering some os-package function that provided env var expansion for windows-style conventions (even if it was as simple as a wrapper for the native ExpandEnvironmentStrings function)
The text was updated successfully, but these errors were encountered: