INNER CODE UNIT · Go
checkVersion
shenwei356/rush · helper.go:39
func checkVersion() {
app := "rush"
fmt.Printf("%s v%s\n", app, VERSION)
fmt.Println("\nChecking new version...")
resp, err := http.Get(fmt.Sprintf("https://github.com/shenwei356/%s/releases/latest", app))
if err != nil {
checkError(fmt.Errorf("Network error"))
}
items := strings.Split(resp.Request.URL.String(), "/")
var version string
if items[len(items)-1] == "" {
version = items[len(items)-2]
} else {
version = items[len(items)-1]
}
if version == "v"+VERSION {
fmt.Printf("You are using the latest version of %s\n", app)