File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -251,16 +251,17 @@ func (m Map) SubTree(rootKey string) Map {
251
251
//
252
252
// Each marker is replaced by the corresponding value of the Map.
253
253
// The values in the Map may contains other markers, they are evaluated
254
- // recursively.
254
+ // recursively up to 10 times .
255
255
func (m Map ) ExpandPropsInString (str string ) string {
256
- replaced := true
257
- for i := 0 ; i < 10 && replaced ; i ++ {
258
- replaced = false
256
+ for i := 0 ; i < 10 ; i ++ {
257
+ newStr := str
259
258
for key , value := range m {
260
- newStr := strings .Replace (str , "{" + key + "}" , value , - 1 )
261
- replaced = replaced || str != newStr
262
- str = newStr
259
+ newStr = strings .Replace (newStr , "{" + key + "}" , value , - 1 )
263
260
}
261
+ if str == newStr {
262
+ break
263
+ }
264
+ str = newStr
264
265
}
265
266
return str
266
267
}
You can’t perform that action at this time.
0 commit comments