Skip to content

In generate code, regexp.MustCompile in function body #28

@plsenp

Description

@plsenp

Describe the feature

In the generated code, regexp.MustCompile is being called within the function. This leads to unnecessary recompilation on each invocation and affects performance. Maybe defining the regex at the package level (outside the function) to compile it only once.

reTrim := regexp.MustCompile(`(?i)^\s*(?:and|or)\s+|\s+(?:and|or)\s*$`)

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