1
0
mirror of https://github.com/go-task/task.git synced 2025-11-23 22:24:45 +02:00

refactor: decouple fingerprinting from executor (#1039)

This commit is contained in:
Pete Davison
2023-03-10 18:27:30 +00:00
committed by GitHub
parent c64f8818be
commit 0838d48ee3
24 changed files with 734 additions and 241 deletions

31
internal/env/env.go vendored Normal file
View File

@@ -0,0 +1,31 @@
package env
import (
"fmt"
"os"
"github.com/go-task/task/v3/taskfile"
)
func Get(t *taskfile.Task) []string {
if t.Env == nil {
return nil
}
environ := os.Environ()
for k, v := range t.Env.ToCacheMap() {
str, isString := v.(string)
if !isString {
continue
}
if _, alreadySet := os.LookupEnv(k); alreadySet {
continue
}
environ = append(environ, fmt.Sprintf("%s=%s", k, str))
}
return environ
}