|
33 | 33 | errInvalidMetadata = errors.New("metadata should be a TOML table")
|
34 | 34 |
|
35 | 35 | errInvalidProjectRoot = errors.New("ProjectRoot name validation failed")
|
36 |
| - errInefficientRules = errors.New("Inefficient rules found in the manifest") |
| 36 | + errInefficientRules = errors.New("inefficient rules found in the manifest") |
37 | 37 |
|
38 | 38 | errInvalidPruneValue = errors.New("prune options values must be booleans")
|
39 | 39 | errPruneSubProject = errors.New("prune projects should not contain sub projects")
|
@@ -326,7 +326,7 @@ func ValidateProjectRoots(c *Ctx, m *Manifest, sm gps.SourceManager) error {
|
326 | 326 | }
|
327 | 327 |
|
328 | 328 | // ValidatePackageRules ensure that there are no ineffectual package declarations
|
329 |
| -// in the constraints, overrides, required, and ignored rules in the manifest. |
| 329 | +// in the constraints, overrides, and ignored rules in the manifest. |
330 | 330 | func ValidatePackageRules(c *Ctx, proj *Project, sm gps.SourceManager) (err error) {
|
331 | 331 | directDeps, err := proj.DirectDependencies(sm)
|
332 | 332 | if err != nil {
|
@@ -357,25 +357,19 @@ func ValidatePackageRules(c *Ctx, proj *Project, sm gps.SourceManager) (err erro
|
357 | 357 | }
|
358 | 358 |
|
359 | 359 | // FindIneffectualConstraints looks for constraints decleared in the project
|
360 |
| -// manifest that aren't directly used in the project. Required packages are an |
361 |
| -// exception to this check. |
| 360 | +// manifest that aren't directly used in the project. |
362 | 361 | func FindIneffectualConstraints(m *Manifest, directDeps map[string]bool) []gps.ProjectRoot {
|
363 |
| - // Treat required packages as if they were direct dependencies |
364 |
| - for pr, _ := range m.RequiredPackages() { |
365 |
| - directDeps[string(pr)] = true |
366 |
| - } |
367 |
| - |
368 | 362 | ineffectuals := make([]gps.ProjectRoot, 0)
|
369 |
| - // Check constraints |
| 363 | + // Check constraints in the manifest. |
370 | 364 | pc := m.DependencyConstraints()
|
371 |
| - for pr, _ := range pc { |
| 365 | + for pr := range pc { |
372 | 366 | if !directDeps[string(pr)] {
|
373 | 367 | ineffectuals = append(ineffectuals, pr)
|
374 | 368 | }
|
375 | 369 | }
|
376 | 370 |
|
377 |
| - // Check overrides as well |
378 |
| - for pr, _ := range m.Overrides() { |
| 371 | + // Check overrides in the manifest. |
| 372 | + for pr := range m.Overrides() { |
379 | 373 | if !directDeps[string(pr)] {
|
380 | 374 | ineffectuals = append(ineffectuals, pr)
|
381 | 375 | }
|
|
0 commit comments