(n int)
| 1340 | } |
| 1341 | |
| 1342 | func currentAndLatestVersions(n int) ([]string, error) { |
| 1343 | bs, err := runError("git", "tag", "--sort", "taggerdate") |
| 1344 | if err != nil { |
| 1345 | return nil, err |
| 1346 | } |
| 1347 | |
| 1348 | lines := strings.Split(string(bs), "\n") |
| 1349 | reverseStrings(lines) |
| 1350 | |
| 1351 | // The one at the head is the latest version. We always keep that one. |
| 1352 | // Then we filter out remaining ones with dashes (pre-releases etc). |
| 1353 | |
| 1354 | latest := lines[:1] |
| 1355 | nonPres := filterStrings(lines[1:], func(s string) bool { return !strings.Contains(s, "-") }) |
| 1356 | vers := append(latest, nonPres...) |
| 1357 | return vers[:n], nil |
| 1358 | } |
| 1359 | |
| 1360 | func reverseStrings(ss []string) { |
| 1361 | for i := 0; i < len(ss)/2; i++ { |
no test coverage detected