-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
87 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"Version": "0.0.0", | ||
"Changes": ["initial updater"] | ||
"Version": "0.0.2", | ||
"Changes": ["May be seen on github"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package utils | ||
|
||
import ( | ||
"io" | ||
"net/http" | ||
"os" | ||
) | ||
|
||
func DownloadFile(file, url string) error { | ||
// Remove any existing file | ||
_ = os.Remove(file) | ||
out, err := os.Create(file) | ||
if err != nil { | ||
return err | ||
} | ||
defer out.Close() | ||
|
||
resp, err := http.Get(url) | ||
if err != nil { | ||
return err | ||
} | ||
defer resp.Body.Close() | ||
|
||
_, err = io.Copy(out, resp.Body) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package utils | ||
|
||
import ( | ||
"errors" | ||
"runtime" | ||
) | ||
|
||
func GetSupportedOS() (string, error) { | ||
switch runtime.GOOS { | ||
case "windows", "darwin", "linux": | ||
return runtime.GOOS, nil | ||
default: | ||
return "", errors.New("unsupported OS") | ||
} | ||
} | ||
|
||
func GetSupportedARCH() (string, error) { | ||
switch runtime.GOARCH { | ||
case "amd64", "arm64": | ||
return runtime.GOARCH, nil | ||
default: | ||
return "", errors.New("unsupported ARCH") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters