Clarifying env
and var
in Go-Task with Practical Examples
#1443
bayeslearner
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
-
I've been exploring Go-Task and came across some intriguing aspects regarding
var
andenv
. 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
env
andvar
treated 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
env
variables inherit globalenv
values but override them in case of a conflict? So the local env doesn't have to define ALLenv
if you know it exists as a globalenv
?How do we distinguish between
vars
andenv
in the provided script?What confuses me is that in the global
var
section,{{.CONFIG}}
seems to be using anenv
for setting a regularvar
. Is this due to the precedence rule where it tries to find avar
to use, but as a last resort, it will fetch an environment variable of the same name if it exists?Are local
env
variables reevaluated every time a task runs?When the task
bar
is invoked, is theenv
variable 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