You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2019/11/04 16:10:50 UTC

[camel-k] 26/38: fix(lint): Use regexp.MustCompile

This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 1066a8910e00e4bffa0c02050dc105e8ccf2bb44
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Fri Oct 25 16:28:07 2019 +0200

    fix(lint): Use regexp.MustCompile
---
 pkg/trait/util.go | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/pkg/trait/util.go b/pkg/trait/util.go
index 9c3e12c..6413f4c 100644
--- a/pkg/trait/util.go
+++ b/pkg/trait/util.go
@@ -33,15 +33,7 @@ import (
 	k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
 )
 
-var exactVersionRegexp regexp.Regexp
-
-func init() {
-	r, err := regexp.Compile(`^(\d+)\.(\d+)\.([\w-\.]+)$`)
-	if err != nil {
-		panic(err)
-	}
-	exactVersionRegexp = *r
-}
+var exactVersionRegexp = regexp.MustCompile(`^(\d+)\.(\d+)\.([\w-.]+)$`)
 
 // GetIntegrationKit retrieves the kit set on the integration
 func GetIntegrationKit(ctx context.Context, c client.Client, integration *v1alpha1.Integration) (*v1alpha1.IntegrationKit, error) {