From 65fbfed035dfc91382475d3d7023c1dd3edd801e Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Tue, 11 Nov 2014 09:26:15 -0800 Subject: [PATCH] reverse sorting private params when injecting --- shared/build/script/inject.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/shared/build/script/inject.go b/shared/build/script/inject.go index f52c290b..6d8d7528 100644 --- a/shared/build/script/inject.go +++ b/shared/build/script/inject.go @@ -1,6 +1,7 @@ package script import ( + "sort" "strings" ) @@ -8,8 +9,14 @@ func Inject(script string, params map[string]string) string { if params == nil { return script } + keys := []string{} + for k, _ := range params { + keys = append(keys, k) + } + sort.Sort(sort.Reverse(sort.StringSlice(keys))) injected := script - for k, v := range params { + for _, k := range keys { + v := params[k] injected = strings.Replace(injected, "$$"+k, v, -1) } return injected