trimOldestNotSupported removes "Not Supported" rows from the start until we have at most 8 rows total, keeping at least one "Not Supported" row if any exist.
(rows []calendarRow)
| 246 | // start until we have at most 8 rows total, keeping at least |
| 247 | // one "Not Supported" row if any exist. |
| 248 | func trimOldestNotSupported(rows []calendarRow) []calendarRow { |
| 249 | const maxRows = 8 |
| 250 | for len(rows) > maxRows { |
| 251 | // Find the first "Not Supported" row. |
| 252 | found := -1 |
| 253 | for i, r := range rows { |
| 254 | if r.Status == "Not Supported" { |
| 255 | found = i |
| 256 | break |
| 257 | } |
| 258 | } |
| 259 | if found == -1 { |
| 260 | break |
| 261 | } |
| 262 | // Count how many "Not Supported" rows we have. |
| 263 | nsCount := 0 |
| 264 | for _, r := range rows { |
| 265 | if r.Status == "Not Supported" { |
| 266 | nsCount++ |
| 267 | } |
| 268 | } |
| 269 | // Keep at least one. |
| 270 | if nsCount <= 1 { |
| 271 | break |
| 272 | } |
| 273 | rows = append(rows[:found], rows[found+1:]...) |
| 274 | } |
| 275 | return rows |
| 276 | } |
| 277 | |
| 278 | // updateCalendarFile reads the releases index.md, updates the |
| 279 | // calendar table, and writes it back. |