refactor: move task, error and testing utils to separte repo; apply gofumpt

This commit is contained in:
yusing
2025-09-27 13:41:50 +08:00
parent 5043ef778f
commit 6776f20332
203 changed files with 696 additions and 2800 deletions

View File

@@ -101,30 +101,30 @@ var versionRegex = regexp.MustCompile(`^v(\d+)\.(\d+)\.(\d+)(\-\w+)?$`)
func ParseVersion(v string) (ver Version) {
if v == "" {
return
return ver
}
if !versionRegex.MatchString(v) { // likely feature branch (e.g. feat/some-feature)
return
return ver
}
v = strings.Split(v, "-")[0]
v = strings.TrimPrefix(v, "v")
parts := strings.Split(v, ".")
if len(parts) != 3 {
return
return ver
}
gen, err := strconv.Atoi(parts[0])
if err != nil {
return
return ver
}
major, err := strconv.Atoi(parts[1])
if err != nil {
return
return ver
}
minor, err := strconv.Atoi(parts[2])
if err != nil {
return
return ver
}
return Ver(gen, major, minor)
}