enable to use .gzip for releases

This commit is contained in:
rhysd 2017-12-28 13:46:26 +09:00
parent 6fe53791b2
commit 231184f71b
2 changed files with 4 additions and 3 deletions

View File

@ -12,12 +12,13 @@ const version = "1.2.3"
func selfUpdate() error {
selfupdate.EnableLog()
latest, err := selfupdate.TryUpdate(version, "go-github-selfupdate", nil)
previous := semver.Make(version)
latest, err := selfupdate.TryUpdate(previous, "go-github-selfupdate", nil)
if err != nil {
return err
}
previous := semver.Make(version)
if previous.Equals(latest.Version) {
fmt.Println("Current binary is the latest version", version)
} else {

View File

@ -25,7 +25,7 @@ func findSuitableReleaseAndAsset(rels []*github.RepositoryRelease) (*github.Repo
// Generate candidates
cs := make([]string, 0, 8)
for _, sep := range []rune{'_', '-'} {
for _, ext := range []string{".zip", ".tar.gz", ""} {
for _, ext := range []string{".zip", ".tar.gz", ".gzip", ""} {
suffix := fmt.Sprintf("%s%c%s%s", runtime.GOOS, sep, runtime.GOARCH, ext)
cs = append(cs, suffix)
if runtime.GOOS == "windows" {