(current, latest string)
| 43 | } |
| 44 | |
| 45 | func isNewerVersion(current, latest string) bool { |
| 46 | |
| 47 | currentYear, currentMonth, currentRelease, err := parseVersion(current) |
| 48 | if err != nil { |
| 49 | return false |
| 50 | } |
| 51 | |
| 52 | latestYear, latestMonth, latestRelease, err := parseVersion(latest) |
| 53 | if err != nil { |
| 54 | return false |
| 55 | } |
| 56 | |
| 57 | if latestYear > currentYear { |
| 58 | |
| 59 | return true |
| 60 | } |
| 61 | if latestYear < currentYear { |
| 62 | |
| 63 | return false |
| 64 | } |
| 65 | |
| 66 | if latestMonth > currentMonth { |
| 67 | return true |
| 68 | } |
| 69 | if latestMonth < currentMonth { |
| 70 | |
| 71 | return false |
| 72 | } |
| 73 | |
| 74 | return latestRelease > currentRelease |
| 75 | } |
| 76 | |
| 77 | func checkForUpdates(currentVersion string) (bool, string) { |
| 78 | client := http.Client{ |
no test coverage detected