cwdModuleName reads the module name from the dagger.json in moduleDir.
(ctx context.Context, readFile func(context.Context, string) ([]byte, error), moduleDir string)
| 383 | |
| 384 | // cwdModuleName reads the module name from the dagger.json in moduleDir. |
| 385 | func 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 | |
| 399 | func pendingLegacyModule( |
| 400 | ws *workspace.Workspace, |
no test coverage detected