aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-connectivity/consul/files/0001-prepared_query-make-compatible-with-go1.5.patch
blob: 324530b65392d2ff3a9dbafdd75f4a282db266e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From fb11d9e31788c912f94faf8b188278d54dc9a8f1 Mon Sep 17 00:00:00 2001
From: Bruce Ashfield <bruce.ashfield@windriver.com>
Date: Wed, 20 Apr 2016 16:34:50 -0400
Subject: [PATCH] prepared_query: make compatible with go1.5

The copying of a regex is only in go 1.6. We can take the chance of
lock contention, so we drop the copy and use the regex directly.

Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
---
 src/github.com/hashicorp/consul/consul/prepared_query/template.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/github.com/hashicorp/consul/consul/prepared_query/template.go b/src/github.com/hashicorp/consul/consul/prepared_query/template.go
index 984f0bcf9cc6..1c61910c1526 100644
--- a/src/github.com/hashicorp/consul/consul/prepared_query/template.go
+++ b/src/github.com/hashicorp/consul/consul/prepared_query/template.go
@@ -116,8 +116,8 @@ func (ct *CompiledTemplate) Render(name string) (*structs.PreparedQuery, error)
 	// from multiple goroutines.
 	var matches []string
 	if ct.re != nil {
-		re := ct.re.Copy()
-		matches = re.FindStringSubmatch(name)
+		// re := ct.re.Copy()
+		matches = ct.re.FindStringSubmatch(name)
 	}
 
 	// Create a safe match function that can't fail at run time. It will
-- 
2.4.0.53.g8440f74