MCPcopy
hub / github.com/go-task/task / GetFromVars

Function GetFromVars

internal/env/env.go:36–52  ·  view source on GitHub ↗
(env *ast.Vars)

Source from the content-addressed store, hash-verified

34}
35
36func GetFromVars(env *ast.Vars) []string {
37 environ := os.Environ()
38
39 for k, v := range env.ToCacheMap() {
40 if !isTypeAllowed(v) {
41 continue
42 }
43 if !experiments.EnvPrecedence.Enabled() {
44 if _, alreadySet := os.LookupEnv(k); alreadySet {
45 continue
46 }
47 }
48 environ = append(environ, fmt.Sprintf("%s=%v", k, v))
49 }
50
51 return environ
52}
53
54func isTypeAllowed(v any) bool {
55 switch v.(type) {

Callers 3

compiledTaskMethod · 0.92
getVariablesMethod · 0.92
GetFunction · 0.85

Calls 3

isTypeAllowedFunction · 0.85
ToCacheMapMethod · 0.80
EnabledMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…