(opaqueIDs ...string)
| 341 | } |
| 342 | |
| 343 | func (m *moduleSet) WithTargetOpaqueIDs(opaqueIDs ...string) (ModuleSet, error) { |
| 344 | if len(opaqueIDs) == 0 { |
| 345 | return nil, errors.New("at least one Module must be targeted") |
| 346 | } |
| 347 | opaqueIDMap := xslices.ToStructMap(opaqueIDs) |
| 348 | modules := make([]Module, len(m.modules)) |
| 349 | for i, module := range m.modules { |
| 350 | _, isTarget := opaqueIDMap[module.OpaqueID()] |
| 351 | // Always make a copy regardless of if targeting changes. We're going to set a new ModuleSet on the Module. |
| 352 | module, err := module.withIsTarget(isTarget) |
| 353 | if err != nil { |
| 354 | return nil, err |
| 355 | } |
| 356 | modules[i] = module |
| 357 | } |
| 358 | return newModuleSet(modules) |
| 359 | } |
| 360 | |
| 361 | // This should only be used by Modules and FileInfos. |
| 362 | func (m *moduleSet) getModuleForFilePath(ctx context.Context, filePath string) (Module, error) { |
nothing calls this directly
no test coverage detected