Skip to content

Package regex does not match package names with numbers #39

@mkingvc

Description

@mkingvc

Overview

First let me say thank you for working on this awesome library. I hope to use it soon in production code!

The Problem I'm Seeing

When calling the archunit.Packages() function like:

archunit.Packages("controllers", "internal/controllers/v3")

I am getting an error reading:

"invalid package paths: internal/controllers/v3"

In looking into the implementation of Packages(), the function internal.PkgPattern() is attempting to validate the package path against a regex that fails on the string "v3": ^(?:[a-zA-Z]+(?:\.[a-zA-Z]+)*|\.\.\.)$.

What I Expect

As v3 is a valid golang package name, I would hope that I would be able to use it with archunit.

Possible Solution

The regex would validate my package path if the regex were updated to be: ^(?:[a-zA-Z][a-zA-Z0-9]*(?:\.[a-zA-Z0-9]+)*|\.\.\.)$

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions