From cb47740d6236e604311c5049e252600bec78b08b Mon Sep 17 00:00:00 2001 From: jannfis Date: Fri, 14 Jan 2022 19:28:34 +0100 Subject: [PATCH] chore(deps): Update github.com/Masterminds/semver to v3.1.1 (#8180) * chore(deps): Upgrade Masterminds/semver to v3.1.1 Signed-off-by: jannfis * Do not anchor regexp Signed-off-by: jannfis --- go.mod | 2 +- go.sum | 2 ++ reposerver/repository/repository.go | 2 +- util/grpc/useragent.go | 2 +- util/helm/index.go | 2 +- util/helm/index_test.go | 2 +- util/helm/version.go | 2 +- util/kustomize/kustomize.go | 11 +++++++++-- 8 files changed, 17 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 26fe5bfa997fd..57bf5c489a02b 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible - github.com/Masterminds/semver v1.5.0 + github.com/Masterminds/semver/v3 v3.1.1 github.com/TomOnTime/utfutil v0.0.0-20180511104225-09c41003ee1d github.com/alicebob/miniredis v2.5.0+incompatible github.com/alicebob/miniredis/v2 v2.14.2 diff --git a/go.sum b/go.sum index 378ac3d8d3cf3..07cc04922db99 100644 --- a/go.sum +++ b/go.sum @@ -72,6 +72,8 @@ github.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RP github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= diff --git a/reposerver/repository/repository.go b/reposerver/repository/repository.go index 2f99e1474b549..4daaf3f998b54 100644 --- a/reposerver/repository/repository.go +++ b/reposerver/repository/repository.go @@ -18,7 +18,7 @@ import ( "github.com/argoproj/argo-cd/v2/util/argo" - "github.com/Masterminds/semver" + "github.com/Masterminds/semver/v3" "github.com/TomOnTime/utfutil" "github.com/argoproj/gitops-engine/pkg/utils/kube" textutils "github.com/argoproj/gitops-engine/pkg/utils/text" diff --git a/util/grpc/useragent.go b/util/grpc/useragent.go index 325ce7f51d9bd..818525c8d3875 100644 --- a/util/grpc/useragent.go +++ b/util/grpc/useragent.go @@ -3,7 +3,7 @@ package grpc import ( "strings" - "github.com/Masterminds/semver" + "github.com/Masterminds/semver/v3" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/util/helm/index.go b/util/helm/index.go index 2d46b777add47..8dcdb7bf33cbe 100644 --- a/util/helm/index.go +++ b/util/helm/index.go @@ -6,7 +6,7 @@ import ( log "github.com/sirupsen/logrus" - "github.com/Masterminds/semver" + "github.com/Masterminds/semver/v3" ) type Entry struct { diff --git a/util/helm/index_test.go b/util/helm/index_test.go index e58f5099f5216..152fceae02c6d 100644 --- a/util/helm/index_test.go +++ b/util/helm/index_test.go @@ -3,7 +3,7 @@ package helm import ( "testing" - "github.com/Masterminds/semver" + "github.com/Masterminds/semver/v3" "github.com/stretchr/testify/assert" ) diff --git a/util/helm/version.go b/util/helm/version.go index 695ac71818750..89746843525c7 100644 --- a/util/helm/version.go +++ b/util/helm/version.go @@ -1,6 +1,6 @@ package helm -import "github.com/Masterminds/semver" +import "github.com/Masterminds/semver/v3" func IsVersion(text string) bool { _, err := semver.NewVersion(text) diff --git a/util/kustomize/kustomize.go b/util/kustomize/kustomize.go index f664c60f3f8e9..58b3fe95a8738 100644 --- a/util/kustomize/kustomize.go +++ b/util/kustomize/kustomize.go @@ -11,7 +11,7 @@ import ( "strings" "sync" - "github.com/Masterminds/semver" + "github.com/Masterminds/semver/v3" "github.com/argoproj/gitops-engine/pkg/utils/kube" "github.com/pkg/errors" @@ -223,9 +223,16 @@ func IsKustomization(path string) bool { return false } +// semver/v3 doesn't export the regexp anymore, so shamelessly copied it over to +// here. +// https://github.com/Masterminds/semver/blob/49c09bfed6adcffa16482ddc5e5588cffff9883a/version.go#L42 +const semVerRegex string = `v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?` + + `(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` + + `(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` + var ( unknownVersion = semver.MustParse("v99.99.99") - semverRegex = regexp.MustCompile(semver.SemVerRegex) + semverRegex = regexp.MustCompile(semVerRegex) semVer *semver.Version semVerLock sync.Mutex )