(name string, slotCount int)
| 348 | } |
| 349 | |
| 350 | func matchSlot(name string, slotCount int) (int, bool) { |
| 351 | if idx, found := strings.CutPrefix(name, indexPrefix); found { |
| 352 | idx, err := strconv.Atoi(idx) |
| 353 | // Return not found if the index is not numeric |
| 354 | if err != nil { |
| 355 | return -1, false |
| 356 | } |
| 357 | // Return not found if the index is not a valid slot |
| 358 | if idx < 0 || idx >= slotCount { |
| 359 | return -1, false |
| 360 | } |
| 361 | return idx, true |
| 362 | } |
| 363 | return -1, false |
| 364 | } |
| 365 | |
| 366 | var ( |
| 367 | indexPrefix = "@index" |
no outgoing calls
no test coverage detected