MCPcopy Create free account
hub / github.com/MertJSX/folderhost / parseVersion

Function parseVersion

utils/version_checker.go:19–43  ·  view source on GitHub ↗
(version string)

Source from the content-addressed store, hash-verified

17}
18
19func parseVersion(version string) (int, int, int, error) {
20 version = strings.TrimPrefix(version, "v")
21
22 parts := strings.Split(version, ".")
23 if len(parts) != 3 {
24 return 0, 0, 0, fmt.Errorf("invalid version format: %s", version)
25 }
26
27 year, err := strconv.Atoi(parts[0])
28 if err != nil {
29 return 0, 0, 0, err
30 }
31
32 month, err := strconv.Atoi(parts[1])
33 if err != nil {
34 return 0, 0, 0, err
35 }
36
37 release, err := strconv.Atoi(parts[2])
38 if err != nil {
39 return 0, 0, 0, err
40 }
41
42 return year, month, release, nil
43}
44
45func isNewerVersion(current, latest string) bool {
46

Callers 1

isNewerVersionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected