GetLatest returns the latest version of the band if it was found, and returns an error otherwise.
(id string)
| 271 | // GetLatest returns the latest version of the band if it was found, |
| 272 | // and returns an error otherwise. |
| 273 | func GetLatest(id string) (Band, error) { |
| 274 | versions, ok := All[id] |
| 275 | if !ok { |
| 276 | return Band{}, errBandNotFound.WithAttributes("id", id, "version", "latest") |
| 277 | } |
| 278 | latestVersion, ok := LatestVersion[id] |
| 279 | if !ok { |
| 280 | return Band{}, errBandNotFound.WithAttributes("id", id, "version", "latest") |
| 281 | } |
| 282 | band, ok := versions[latestVersion] |
| 283 | if !ok { |
| 284 | return Band{}, errBandNotFound.WithAttributes("id", id, "version", latestVersion) |
| 285 | } |
| 286 | return band, nil |
| 287 | } |