Clarifying env and var in Go-Task with Practical Examples
#1443
bayeslearnerold
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been exploring Go-Task and came across some intriguing aspects regarding
varandenv. Their usage and impact on task outputs seem nuanced, and I'd appreciate some community insights. Here's a sample YAML file for context:The output:
Alongside understanding the output for this configuration, I have a few more queries:
Are
envandvartreated the same in Go-Task, and what are their fundamental differences?It seems they are not identical and exist in different namespaces, similar to other programming languages.
How does scoping work with Go-Task vars?
Are they dynamically reevaluated like local variables in other languages?
Are there different ways to pass
env, and do they override globalenv?Do local
envvariables inherit globalenvvalues but override them in case of a conflict? So the local env doesn't have to define ALLenvif you know it exists as a globalenv?How do we distinguish between
varsandenvin the provided script?What confuses me is that in the global
varsection,{{.CONFIG}}seems to be using anenvfor setting a regularvar. Is this due to the precedence rule where it tries to find avarto use, but as a last resort, it will fetch an environment variable of the same name if it exists?Are local
envvariables reevaluated every time a task runs?When the task
baris invoked, is theenvvariable re-evaluated?Could someone kindly provide insights or explanations on these points? There are still many open issues involving env/var interactions such as #1276 #203
Beta Was this translation helpful? Give feedback.
All reactions