github.com/sona-tar/ghs@v0.0.0-20170415134710-bed1b2953748/version.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  
     7  	"github.com/tcnksm/go-latest"
     8  )
     9  
    10  func CheckVersion(ver string) {
    11  	if os.Getenv("GHS_PRINT") != "no" {
    12  		githubTag := &latest.GithubTag{
    13  			Owner:      "sona-tar",
    14  			Repository: "ghs",
    15  		}
    16  		res, _ := latest.Check(githubTag, ver)
    17  		if res.Outdated {
    18  			fmt.Printf(fmt.Sprintf("%s is not latest, you should upgrade to %s\n", ver, res.Current))
    19  			fmt.Printf("-> $ brew update && brew upgrade sona-tar/tools/ghs\n")
    20  		}
    21  	}
    22  }