File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,16 @@ type SelfUpdateCommand struct {
19
19
Force bool `long:"force" description:"force update"`
20
20
}
21
21
22
+ var (
23
+ selfUpdateOsTranslationMap = map [string ]string {
24
+ "darwin" : "osx" ,
25
+ }
26
+ selfUpdateArchTranslationMap = map [string ]string {
27
+ "amd64" : "x64" ,
28
+ "386" : "x32" ,
29
+ }
30
+ )
31
+
22
32
func (conf * SelfUpdateCommand ) Execute (args []string ) error {
23
33
fmt .Println ("Starting self update" )
24
34
@@ -39,18 +49,14 @@ func (conf *SelfUpdateCommand) Execute(args []string) error {
39
49
40
50
// translate OS names
41
51
os := runtime .GOOS
42
- switch (runtime .GOOS ) {
43
- case "darwin" :
44
- os = "osx"
52
+ if val , ok := selfUpdateOsTranslationMap [os ]; ok {
53
+ os = val
45
54
}
46
55
47
56
// translate arch names
48
57
arch := runtime .GOARCH
49
- switch (arch ) {
50
- case "amd64" :
51
- arch = "x64"
52
- case "386" :
53
- arch = "x32"
58
+ if val , ok := selfUpdateArchTranslationMap [arch ]; ok {
59
+ arch = val
54
60
}
55
61
56
62
// build asset name
You can’t perform that action at this time.
0 commit comments