Commit | Line | Data |
---|---|---|
648ae621 JK |
1 | From bc22f7d43c12c5f79c71b0319666e71f29d61322 Mon Sep 17 00:00:00 2001 |
2 | From: =?UTF-8?q?Jakub=20K=C4=85dzio=C5=82ka?= <kuba@kadziolka.net> | |
3 | Date: Mon, 25 May 2020 18:53:04 +0200 | |
4 | Subject: [PATCH] Disable self-update. | |
5 | ||
6 | Based on a Fedora patch by Elliott Sales de Andrade. | |
7 | --- | |
8 | cli/cli.go | 44 +------------------------------------------- | |
9 | 1 file changed, 1 insertion(+), 43 deletions(-) | |
10 | ||
11 | diff --git a/cli/cli.go b/cli/cli.go | |
12 | index 4312eb0..5f62297 100644 | |
13 | --- a/cli/cli.go | |
14 | +++ b/cli/cli.go | |
15 | @@ -10,13 +10,10 @@ import ( | |
16 | "io" | |
17 | "io/ioutil" | |
18 | "net/http" | |
19 | - "runtime" | |
20 | "strings" | |
21 | "time" | |
22 | ||
23 | "github.com/blang/semver" | |
24 | - "github.com/exercism/cli/debug" | |
25 | - update "github.com/inconshreveable/go-update" | |
26 | ) | |
27 | ||
28 | var ( | |
29 | @@ -95,46 +92,7 @@ func (c *CLI) IsUpToDate() (bool, error) { | |
30 | ||
31 | // Upgrade allows the user to upgrade to the latest version of the CLI. | |
32 | func (c *CLI) Upgrade() error { | |
33 | - var ( | |
34 | - OS = osMap[runtime.GOOS] | |
35 | - ARCH = archMap[runtime.GOARCH] | |
36 | - ) | |
37 | - | |
38 | - if OS == "" || ARCH == "" { | |
39 | - return fmt.Errorf("unable to upgrade: OS %s ARCH %s", OS, ARCH) | |
40 | - } | |
41 | - | |
42 | - buildName := fmt.Sprintf("%s-%s", OS, ARCH) | |
43 | - if BuildARCH == "arm" { | |
44 | - if BuildARM == "" { | |
45 | - return fmt.Errorf("unable to upgrade: arm version not found") | |
46 | - } | |
47 | - buildName = fmt.Sprintf("%s-v%s", buildName, BuildARM) | |
48 | - } | |
49 | - | |
50 | - var downloadRC *bytes.Reader | |
51 | - for _, a := range c.LatestRelease.Assets { | |
52 | - if strings.Contains(a.Name, buildName) { | |
53 | - debug.Printf("Downloading %s\n", a.Name) | |
54 | - var err error | |
55 | - downloadRC, err = a.download() | |
56 | - if err != nil { | |
57 | - return fmt.Errorf("error downloading executable: %s", err) | |
58 | - } | |
59 | - break | |
60 | - } | |
61 | - } | |
62 | - if downloadRC == nil { | |
63 | - return fmt.Errorf("no executable found for %s/%s%s", BuildOS, BuildARCH, BuildARM) | |
64 | - } | |
65 | - | |
66 | - bin, err := extractBinary(downloadRC, OS) | |
67 | - if err != nil { | |
68 | - return err | |
69 | - } | |
70 | - defer bin.Close() | |
71 | - | |
72 | - return update.Apply(bin, update.Options{}) | |
73 | + return fmt.Errorf("Please use Guix to update Exercism") | |
74 | } | |
75 | ||
76 | func (c *CLI) fetchLatestRelease() error { | |
77 | -- | |
78 | 2.26.2 | |
79 |