(tokens []string)
| 352 | } |
| 353 | |
| 354 | func formatPath(tokens []string) string { |
| 355 | if len(tokens) == 0 { |
| 356 | return "" |
| 357 | } |
| 358 | segments := []string{} |
| 359 | for _, token := range tokens { |
| 360 | if token == "" { |
| 361 | continue |
| 362 | } |
| 363 | if isArrayIndex(token) { |
| 364 | if len(segments) == 0 { |
| 365 | segments = append(segments, "["+token+"]") |
| 366 | } else { |
| 367 | segments[len(segments)-1] = segments[len(segments)-1] + "[" + token + "]" |
| 368 | } |
| 369 | continue |
| 370 | } |
| 371 | segments = append(segments, token) |
| 372 | } |
| 373 | return strings.Join(segments, ".") |
| 374 | } |
| 375 | |
| 376 | func isArrayIndex(token string) bool { |
| 377 | if token == "" { |
no test coverage detected