Skip to content

os.ExpandEnv doesn't recursively fetch environment variables #16785

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

Closed
jnmoal opened this issue Aug 18, 2016 · 1 comment
Closed

os.ExpandEnv doesn't recursively fetch environment variables #16785

jnmoal opened this issue Aug 18, 2016 · 1 comment

Comments

@jnmoal
Copy link
Contributor

jnmoal commented Aug 18, 2016

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?

go version go1.7 linux/amd64

  1. What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"

  1. What did you do?
    https://play.golang.org/p/-chU68uIbC
  2. What did you expect to see?
    /first/value:/second/value
  3. What did you see instead?
    $ENV1:$ENV2

I'm working on an example for the "os" package to help a little on the issue 16360.

According to how os.Expand is implemented this is not a bug, but I was expecting that this function would recursively fetch the environment variables in order to expand it.

Is this a wanted behavior?

@bradfitz
Copy link
Contributor

I don't think this is wanted behavior. In any case, compatibility would preclude us from changing this, sorry. You'll have to write your own wrapper.

@golang golang locked and limited conversation to collaborators Aug 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants