Better OS check
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
Signed-off-by: jolheiser <john.olheiser@gmail.com>pull/2/head
parent
6ed733d794
commit
183ba921c2
|
@ -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
|
Loading…
Reference in New Issue