about summary refs log tree commit diff
path: root/context/context.go
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2018-06-21T11·55+0200
committerVincent Ambo <github@tazj.in>2018-06-21T12·07+0200
commit92c5c846e2ce19c4c46a70a36c533245538c2dd3 (patch)
treeda2ff59a18e989466fcd68c937b5263502798bf5 /context/context.go
parent01f771fa2fb19ae6ca365c9d08000a81a266d609 (diff)
fix(context): Use SplitN to split CLI variable specifications
In some cases the value of a variable may contain an equals sign,
which would not work in the previous version.

This uses `SplitN` to split the variable specifier into a
pre-determined number (2) of sub-slices. Further `=`-symbols will then
be included in the second substring.
Diffstat (limited to 'context/context.go')
-rw-r--r--context/context.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/context/context.go b/context/context.go
index e6e3d4a12540..321d4fa42c81 100644
--- a/context/context.go
+++ b/context/context.go
@@ -204,7 +204,7 @@ func loadExplicitVars(vars *[]string) (map[string]interface{}, error) {
 	explicitVars := make(map[string]interface{}, len(*vars))
 
 	for _, v := range *vars {
-		varParts := strings.Split(v, "=")
+		varParts := strings.SplitN(v, "=", 2)
 		if len(varParts) != 2 {
 			return nil, fmt.Errorf(`invalid explicit variable provided (%s), name and value should be separated with "="`, v)
 		}