Skip to content

Commit

Permalink
Merge pull request #158 from mattfarina/fix-155
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Farina <matt@mattfarina.com>
  • Loading branch information
mattfarina committed Nov 19, 2020
2 parents 60c7ae8 + 7e314bd commit cccb00c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Expand Up @@ -4,7 +4,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.12.x, 1.13.x, 1.14.x]
go-version: [1.12.x, 1.13.x, 1.14.x, 1.15.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand Down
11 changes: 4 additions & 7 deletions constraints.go
Expand Up @@ -164,14 +164,11 @@ func init() {
"^": constraintCaret,
}

ops := make([]string, 0, len(constraintOps))
for k := range constraintOps {
ops = append(ops, regexp.QuoteMeta(k))
}
ops := `=||!=|>|<|>=|=>|<=|=<|~|~>|\^`

constraintRegex = regexp.MustCompile(fmt.Sprintf(
`^\s*(%s)\s*(%s)\s*$`,
strings.Join(ops, "|"),
ops,
cvRegex))

constraintRangeRegex = regexp.MustCompile(fmt.Sprintf(
Expand All @@ -180,12 +177,12 @@ func init() {

findConstraintRegex = regexp.MustCompile(fmt.Sprintf(
`(%s)\s*(%s)`,
strings.Join(ops, "|"),
ops,
cvRegex))

validConstraintRegex = regexp.MustCompile(fmt.Sprintf(
`^(\s*(%s)\s*(%s)\s*\,?)+$`,
strings.Join(ops, "|"),
ops,
cvRegex))
}

Expand Down

0 comments on commit cccb00c

Please sign in to comment.