diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d484edb..cc4ba21 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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: diff --git a/constraints.go b/constraints.go index 7420823..547613f 100644 --- a/constraints.go +++ b/constraints.go @@ -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( @@ -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)) }