Fix build for upgrade-unsupported platforms
This commit is contained in:
parent
4566690617
commit
144a881ae5
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@ -16,6 +17,12 @@ type githubAsset struct {
|
|||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
errVersionUpToDate = errors.New("current version is up to date")
|
||||||
|
errVersionUnknown = errors.New("couldn't fetch release information")
|
||||||
|
errUpgradeUnsupported = errors.New("upgrade unsupported")
|
||||||
|
)
|
||||||
|
|
||||||
// Returns 1 if a>b, -1 if a<b and 0 if they are equal
|
// Returns 1 if a>b, -1 if a<b and 0 if they are equal
|
||||||
func compareVersions(a, b string) int {
|
func compareVersions(a, b string) int {
|
||||||
arel, apre := versionParts(a)
|
arel, apre := versionParts(a)
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import (
|
|||||||
"archive/tar"
|
"archive/tar"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
@ -26,16 +25,7 @@ import (
|
|||||||
|
|
||||||
var GoArchExtra string // "", "v5", "v6", "v7"
|
var GoArchExtra string // "", "v5", "v6", "v7"
|
||||||
|
|
||||||
var (
|
|
||||||
errVersionUpToDate = errors.New("current version is up to date")
|
|
||||||
errVersionUnknown = errors.New("couldn't fetch release information")
|
|
||||||
)
|
|
||||||
|
|
||||||
func upgrade() error {
|
func upgrade() error {
|
||||||
if runtime.GOOS == "windows" {
|
|
||||||
return errors.New("Upgrade currently unsupported on Windows")
|
|
||||||
}
|
|
||||||
|
|
||||||
path, err := osext.Executable()
|
path, err := osext.Executable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@ -2,10 +2,6 @@
|
|||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "errors"
|
|
||||||
|
|
||||||
var errUpgradeUnsupported = errors.New("Automatic upgrade not supported")
|
|
||||||
|
|
||||||
func upgrade() error {
|
func upgrade() error {
|
||||||
return errUpgradeUnsupported
|
return errUpgradeUnsupported
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user