Skip to content

mirror: --exclude-module/--exclude-package ignore the @version part #425

Description

@ldmonster

Summary

--exclude-module <name>@<version> (and --exclude-package <name>@<version>) ignore the @version part. The documented format is module-name[@version], which implies version-level exclusion, but the whole module/package is excluded regardless of the version supplied.

Details

In blacklist mode Filter.Match matches by name only:

  • internal/mirror/modules/filter.goMatch checks f.modules[mod.Name]; the parsed version constraint is stored but never consulted.

The @version is still parsed at flag-processing time (so it must be a valid semver/constraint, otherwise the command errors), but it has no effect on what is excluded.

Packages reuse modules.Filter, so --exclude-package behaves the same way.

Impact

Silent over-exclusion. A user running --exclude-module foo@1.2.0 expecting to drop a single version actually drops all versions of foo, with no warning.

Expected

Either honor the version constraint in blacklist mode, or reject/document --exclude-module / --exclude-package as name-only.

As of main (62132d6).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions