Skip to content
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

Can I get the original value if variable empty #56

Open
jLopezbarb opened this issue Jun 1, 2023 · 2 comments
Open

Can I get the original value if variable empty #56

jLopezbarb opened this issue Jun 1, 2023 · 2 comments

Comments

@jLopezbarb
Copy link

jLopezbarb commented Jun 1, 2023

Hi, I need to know if there is a variable in my text that is empty after expanding it. I need those variables not to expand and use the original string.

os.Setenv("GREETINGS", "hello")
value := "$GREETINGS $NAME"
result, err := envsubst.String(value)
if err != nil {
	return "", fmt.Errorf("error expanding environment on '%s': %s", value, err.Error())
}
fmt.Println(result) // The output is: "hello "

Is there a way of getting hello $NAME as the output?

@ashvinsharma
Copy link

This would be so helpful.

@artemiyokulov
Copy link

need this too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants