fix an example command and UpdateSelf()
This commit is contained in:
parent
8618b269c4
commit
9c8dc3199b
|
@ -13,7 +13,7 @@ const version = "1.2.3"
|
|||
func selfUpdate() error {
|
||||
selfupdate.EnableLog()
|
||||
|
||||
previous := semver.Make(version)
|
||||
previous := semver.MustParse(version)
|
||||
latest, err := selfupdate.UpdateSelf(previous, "rhysd/go-github-selfupdate")
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -22,14 +22,10 @@ func selfUpdate() error {
|
|||
if previous.Equals(latest.Version) {
|
||||
fmt.Println("Current binary is the latest version", version)
|
||||
} else {
|
||||
fmt.Printf(
|
||||
`Update successfully done to version %v
|
||||
|
||||
Release note:
|
||||
%s
|
||||
`,
|
||||
latest.Version, latest.Description)
|
||||
fmt.Println("Update successfully done to version", latest.Version)
|
||||
fmt.Println("Release note:\n", latest.Description)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func usage() {
|
||||
|
|
|
@ -111,5 +111,5 @@ func UpdateCommand(cmdPath string, current semver.Version, slug string) (*Releas
|
|||
// UpdateSelf updates the running executable itself to the latest version.
|
||||
// 'slug' represents 'owner/name' repository on GitHub and 'current' means the current version.
|
||||
func UpdateSelf(current semver.Version, slug string) (*Release, error) {
|
||||
return UpdateCommand(os.Args[0], current, slug, os.Args[0])
|
||||
return UpdateCommand(os.Args[0], current, slug)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue