MCPcopy Index your code
hub / github.com/dagger/dagger / cwdModuleName

Function cwdModuleName

engine/server/session_workspaces.go:385–397  ·  view source on GitHub ↗

cwdModuleName reads the module name from the dagger.json in moduleDir.

(ctx context.Context, readFile func(context.Context, string) ([]byte, error), moduleDir string)

Source from the content-addressed store, hash-verified

383
384// cwdModuleName reads the module name from the dagger.json in moduleDir.
385func cwdModuleName(ctx context.Context, readFile func(context.Context, string) ([]byte, error), moduleDir string) string {
386 data, err := readFile(ctx, filepath.Join(moduleDir, workspace.ModuleConfigFileName))
387 if err != nil {
388 return ""
389 }
390 var cfg struct {
391 Name string `json:"name"`
392 }
393 if err := json.Unmarshal(data, &cfg); err != nil {
394 return ""
395 }
396 return cfg.Name
397}
398
399func pendingLegacyModule(
400 ws *workspace.Workspace,

Callers 1

Calls 1

UnmarshalMethod · 0.65

Tested by

no test coverage detected