Better OS check
continuous-integration/drone/pr Build is passing Details

Signed-off-by: jolheiser <john.olheiser@gmail.com>
pull/2/head
jolheiser 2021-08-08 23:09:05 -05:00
parent 6ed733d794
commit 183ba921c2
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
1 changed files with 6 additions and 6 deletions

View File

@ -2,7 +2,6 @@ package main
import (
"context"
"errors"
"flag"
"fmt"
"io"
@ -18,9 +17,14 @@ import (
"github.com/schollz/progressbar/v3"
)
var f = false
func main() {
downloadFlag := flag.Bool("download", false, "Download latest Go")
installFlag := flag.Bool("install", false, "Install/Update Go (Linux only)")
installFlag := &f
if runtime.GOOS == "linux" {
installFlag = flag.Bool("install", false, "Install/Update Go")
}
outFlag := flag.String("out", ".", "Where to put the downloaded file")
flag.Parse()
@ -128,10 +132,6 @@ func download(filename, outPath string) error {
}
func install(outPath string) error {
if !strings.EqualFold(runtime.GOOS, "linux") {
return errors.New("Install option is only for Linux. Mac and Windows users should run the downloaded installer.")
}
if os.Geteuid() != 0 {
return fmt.Errorf(`This command must be run as root to perform the install.
Alternatively, you can run the following command manually, which is taken from https://golang.org/doc/install#install