MCPcopy Index your code
hub / github.com/devspace-sh/devspace / NewContext

Function NewContext

pkg/devspace/context/context.go:22–39  ·  view source on GitHub ↗
(ctx context2.Context, variables map[string]interface{}, log log.Logger)

Source from the content-addressed store, hash-verified

20)
21
22func NewContext(ctx context2.Context, variables map[string]interface{}, log log.Logger) Context {
23 var err error
24 workingDir, _ := RealWorkDir()
25 if workingDir == "" {
26 workingDir, err = os.Getwd()
27 if err != nil {
28 panic(errors.Wrap(err, "get current working directory"))
29 }
30 }
31
32 return &context{
33 context: ctx,
34 workingDir: workingDir,
35 runID: strings.ToLower(randutil.GenerateRandomString(12)),
36 environ: env.NewVariableEnvProvider(expand.ListEnviron(os.Environ()...), env.ConvertMap(variables)),
37 log: log,
38 }
39}
40
41func RealWorkDir() (string, error) {
42 if runtime.GOOS == "darwin" {

Callers

nothing calls this directly

Calls 5

GenerateRandomStringFunction · 0.92
NewVariableEnvProviderFunction · 0.92
ConvertMapFunction · 0.92
RealWorkDirFunction · 0.85
EnvironMethod · 0.65

Tested by

no test coverage detected